Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <winsock2.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <iostream>
- #define BACKLOG 5
- using namespace std;
- int main()
- {
- char buf[MAX_PATH];
- WSADATA wsaData;
- WSAStartup(MAKEWORD(1, 1), &wsaData);
- SOCKET hServer = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
- SOCKADDR_IN sai;
- sai.sin_family = AF_INET;
- sai.sin_addr.s_addr = INADDR_ANY;
- sai.sin_port = htons(1337);
- bind(hServer,(LPSOCKADDR)&sai,sizeof(struct sockaddr));
- listen(hServer,10);
- SOCKET hClient = accept(hServer,NULL,NULL);
- while(1==1){
- recv(hClient,buf,sizeof(buf),0);
- cout << buf;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement