Computer Science Canada Networking problem |
Author: | davidkey [ Sun Mar 25, 2012 7:59 pm ] | ||
Post subject: | Networking problem | ||
What is it you are trying to achieve? Stop error from happening What is the problem you are having? I'm getting an error when a Turing program connects to my multi client-server (still working on it). It crashes giving me "I/O attempted on unopened stream number - 10. Open failed with message 'Net Error. Window Socket Library Error #10048'." I used the NetChat program as a client/session. when connected, it shows "127.0.0.1 Joined the server" but right after my server crash. Describe what you have tried to solve this problem tried researching Window Socket Library Error #10048, tells me something about IP/port already used, don't have 2 computers so I don't know if the problem is running client and server on same computer. Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Please specify what version of Turing you are using 4.1 (4.1.1 can't compile) |
Author: | crossley7 [ Sun Mar 25, 2012 10:02 pm ] |
Post subject: | RE:Networking problem |
I don't know much about coding to connect to a network, but after starting to learn a bit of PHP this summer, I would recommend you look at which port is being used for each thing and then possibly switch the server to using some random port instead of the one it currently uses which I'm guessing would be 80 since that is fairly standard. Hope that helps. |
Author: | DemonWasp [ Mon Mar 26, 2012 1:06 am ] |
Post subject: | RE:Networking problem |
Turing is actually really dumb about handling connections. When you complete a handshake, your server should be able to immediately 'listen' to that same port again, while continuing to talk on the existing connections. Turing can't do that. You will have to listen on a different port for each connection. |
Author: | Tony [ Mon Mar 26, 2012 1:32 am ] |
Post subject: | Re: RE:Networking problem |
DemonWasp @ Mon Mar 26, 2012 1:06 am wrote: When you complete a handshake, your server should be able to immediately 'listen' to that same port again, while continuing to talk on the existing connections.
Sure it can. You just have to make sure that at the end of a handshake the server closes the connection, to free up the port to listen to the next incoming message. A typical setup would be: - client requests next available port - server starts a new listener on an available port - server replies with newly opened port - server terminates the connection with a client - server starts listening for next request on known port - client establishes new connection on a port that was allocated for it |
Author: | davidkey [ Mon Mar 26, 2012 2:31 pm ] |
Post subject: | Re: Networking problem |
well i think i found the problem, in process Find, i put 1 stream and multiple addresses, i have now made an array for stream (1 .. max_connection) and seems to work now |
Author: | davidkey [ Mon Mar 26, 2012 2:35 pm ] |
Post subject: | Re: Networking problem |
nvm, there was another error blocking it |
Author: | davidkey [ Mon Mar 26, 2012 3:04 pm ] |
Post subject: | Re: RE:Networking problem |
Tony @ Mon Mar 26, 2012 1:32 am wrote: DemonWasp @ Mon Mar 26, 2012 1:06 am wrote: When you complete a handshake, your server should be able to immediately 'listen' to that same port again, while continuing to talk on the existing connections.
Sure it can. You just have to make sure that at the end of a handshake the server closes the connection, to free up the port to listen to the next incoming message. A typical setup would be: - client requests next available port - server starts a new listener on an available port - server replies with newly opened port - server terminates the connection with a client - server starts listening for next request on known port - client establishes new connection on a port that was allocated for it how do i check if connection ended, or do i end it with Net.CloseConnection if client doesn't respond |
Author: | Tony [ Mon Mar 26, 2012 4:05 pm ] |
Post subject: | RE:Networking problem |
For that common port, you'd want to close the connection ASAP, to free it up for the next request. Server throws a response into the pipe and closes it right away. The client can deal with the rest. |