Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void NetworkManager::Update(NetMSG i_netMSG)
- {
- if(m_connected)
- {
- if(server)
- {
- int size = sizeof(i_netMSG);
- memmove(buffer, &i_netMSG, sizeof(i_netMSG));
- //after connection send n receive data
- iResult = send( ClientSocket, buffer, sizeof(i_netMSG), 0);
- if(iResult == SOCKET_ERROR)
- {
- printf("send failed with error: %d\n", buffer, iResult);
- closesocket(ClientSocket);
- WSACleanup();
- return;
- }
- }
- else if(!server)
- {
- memmove(sendbuf, &i_netMSG, sizeof(i_netMSG));
- //after connection send n receive data
- iResult = send( ConnectSocket, sendbuf, sizeof(i_netMSG), 0);
- if(iResult == SOCKET_ERROR)
- {
- printf("send failed with error: %d\n", sendbuf, iResult);
- closesocket(ConnectSocket);
- WSACleanup();
- return;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment