Computer Science Canada

Using net module not working

Author:  goroyoshi [ Thu May 05, 2011 7:57 pm ]
Post subject:  Using net module not working

whenever i run the program, (note the IP I have set up is my hamachi client, it also connects properly)
I get this error
"I/O attempted on unopened stream number-10. Open failed with message 'Net Error. Windows Socket Library Error #10061'."
here is the code i am using for a test to see if the server holds the variable
Turing:

const port : int := 5055
var netstream : int
var ip : string := "5.87.112.90"
var send : int := 45
netstream := Net.OpenConnection (ip, port)
put "you have connected to ", ip
put : netstream, send

Author:  goroyoshi [ Thu May 05, 2011 8:30 pm ]
Post subject:  RE:Using net module not working

I think that I might have answer, I need to run turing as admin to use net module, because i checked the error code and it's saying the server refuses to connect me

the server is still up
Update:
running as admin won't work,

Author:  chopperdudes [ Fri May 06, 2011 1:27 am ]
Post subject:  RE:Using net module not working

if this is a server then use Net.WaitForConnection or something, use Net.OpenConnection on the client side and supply the ip of the server.

Author:  goroyoshi [ Fri May 06, 2011 11:13 am ]
Post subject:  RE:Using net module not working

I have an IP set up from hamachi
should I use this for a server
Turing:

const port : int := 5055
var netstream : int
var ip : string := "5.87.112.90"
var send : int := 45
netstream := Net.WaitForConnection (port, ip)
get : netstream, send

Author:  chopperdudes [ Fri May 06, 2011 11:33 am ]
Post subject:  RE:Using net module not working

up to the get part you should be fine, but what are you trying to do with the get part? you named the variable "send" and assigned it a value, yet you're trying to get it off of the client?

also, my knowledge with the net module is limited so i don't know if your code will work or not, what i've tried is to put


loop
if Net.CharAvailable (stream) then
var ch : char
get : stream, ch
put ord (ch)
end if
end loop

ch here would be the value of each byte that you receive.


: