A bit of socket programming... what if the meta is responding, but returns nothing?
Posted: Tue Dec 05, 2017 2:11 pm
Here's an interesting problem that's currently happening with the MAngband metaserver: it is responding (you can ping, create a socket and connect), but returns nothing when you try to receive data. Since the TomeNET code is identical (at least for Windows), this could happen also with TomeNET.
Symptom: when launching the client, you get "Connecting to metaserver..." message, but then the client hangs forever.
Workaround: modify your ini file and uncomment (or add) the "host=..." line to connect to a server manually (in case of TomeNET, you also have the convenient "TomeNET direct" executable).
Now a bit of code (from net-win.c)... To connect to the meta, the client calls CreateClientSocket(), checks for failure (in this case, defaults to asking to enter a server name manually), and calls SocketRead() to validate the connection. Our problem here is that CreateClientSocket() succeeds, but SocketRead() fails and waits indefinitely.
So we need to find a way to tell the client that the socket is opened, but unable to send data. Would a call to SocketReadable() work?
Symptom: when launching the client, you get "Connecting to metaserver..." message, but then the client hangs forever.
Workaround: modify your ini file and uncomment (or add) the "host=..." line to connect to a server manually (in case of TomeNET, you also have the convenient "TomeNET direct" executable).
Now a bit of code (from net-win.c)... To connect to the meta, the client calls CreateClientSocket(), checks for failure (in this case, defaults to asking to enter a server name manually), and calls SocketRead() to validate the connection. Our problem here is that CreateClientSocket() succeeds, but SocketRead() fails and waits indefinitely.
So we need to find a way to tell the client that the socket is opened, but unable to send data. Would a call to SocketReadable() work?