C# Server to C++ Client, Winsock Error 10054

Started by
2 comments, last by jef396 19 years, 6 months ago
I'm working on a project where we are creating a multiplayer game. The C# server communicates with numerous C++ clients. The problem we are running into is that the C# server sends a packet without any problems to the C++ client, but when the C++ client calls recvfrom (We are using UDP) it returns -1. After it returns -1 WSAGetLastError() reveals error code 10054 which means that the host reset the connection unexpectedly. Only, it didn't. Why is this happening? Before we run into this error numerous packets are sent and recieved by the server and client, but for some reason just 1 more breaks it. The C# app sends the packet with an identical endpoint as for the packets it successfully sends before that, the only thing that changes is the data. We have tried setting the data to 0, putting the data into the previous packet (which worked, but isn't preferable because later nomatter what we send it screws up). What is going on? Please help, we have run into a brick wall. "But I can't be a ponce, I don't know what it is!" - Jeff J.
Advertisement
Sounds like a bug on either your server code or your client code. Without seeing anything, I would say check scoping on the server (make sure that the client socket always has a reference to it) and check that the SOCKADDR structure pointer is valid, along with the length set to the size of the SOCKADDR structure when you call recvfrom.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

This is a documented bug in Win2k with sp <= 1. It can be disabled on anything beyond this however (through SIO_UDP_CONNRESET).
WinSock Recvfrom() Now Returns WSAECONNRESET Instead of Blocking or Timing Out
Problem fixed. The C++ coder made a mistake. He was using his sending socket to receive.

This topic is closed to new replies.

Advertisement