Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <winsock2.h>
- #include <iostream>
- #include <cstdio>
- #include <cstdlib>
- #pragma comment(lib, "Ws2_32.lib")
- using namespace std;
- int main(int argc, char *argv[])
- {
- WSADATA wsa;
- WORD Version = MAKEWORD (2 , 1);
- WSAStartup(Version, &wsa);
- SOCKET Listen = socket(AF_INET, SOCK_STREAM, NULL);
- SOCKET Connect = socket(AF_INET, SOCK_STREAM, NULL);
- SOCKADDR_IN Server;
- Server.sin_addr.s_addr = inet_addr("95.252.121.246");
- Server.sin_family = AF_INET;
- Server.sin_port = htons(100);
- bind(Listen, (SOCKADDR*)&Server, sizeof(Server));
- listen(Listen, 1);
- int size = sizeof(Server);
- cout << "Listening...";
- while(true){
- if (Connect = accept(Listen, (SOCKADDR*)&Server , &size)){
- cout << "\nConnectet! ";
- break;
- }
- }
- WSACleanup();
- cout << "Press the enter key to continue ...";
- cin.get();
- cin.get();
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement