Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool RunServer(int portNumber)
- {
- SOCKET hSocket = INVALID_SOCKET, hClientSocket = INVALID_SOCKET;
- bool bSuccess = true;
- sockaddr_in sockAddr = {0};
- try {
- // Создаем socket
- cout << "Creating socket... ";
- if ((hSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET)
- throw ROTException("could not create socket.");
- cout << "created.\n";
- // Связывае
- socket cout << "Binding socket... ";
- SetServerSockAddr(&sockAddr, portNumber);
- if (bind(hSocket, reinterpret_cast(&sockAddr), sizeof(sockAddr))!=0)
- throw ROTException("could not bind socket."); cout << "bound.\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement