Page 1 of 1

PB 5.21 b 2 - OpenNetworkConnection

Posted: Tue Nov 12, 2013 7:26 pm
by User_Russian
Function OpenNetworkConnection() returns a non-zero result, even if not connect to the server.

Code: Select all

InitNetwork()
Debug OpenNetworkConnection("192.168.0.8", 1234, #PB_Network_TCP)
Debug OpenNetworkConnection("192.168.0.5", 4321, #PB_Network_TCP)
I can assume that the connection is established in the asynchronous mode. And it confirms the following code.

Code: Select all

InitNetwork()
For x=0 To 255
  For y=0 To 255
    String.s = "192.168."+Str(x)+"."+Str(y)
    z=OpenNetworkConnection(String, 1234, #PB_Network_TCP)
    If z
      CloseNetworkConnection(z)
      Debug String
    EndIf
  Next y
Next x
But why, then, the program Crash after a few tens of seconds, in line with function NetworkClientEvent()?

Code: Select all

InitNetwork()
x = OpenNetworkConnection("192.168.0.8", 1234, #PB_Network_TCP)
Repeat
  z=NetworkClientEvent(x)
  If z<>#PB_NetworkEvent_None
    Debug z
  Else
    Delay(10)
  EndIf
ForEver

Re: PB 5.21 b 2 - OpenNetworkConnection

Posted: Tue Nov 12, 2013 7:43 pm
by Thunder93
OpenNetworkConnection() is returning 0 when connection fails. Not having any problem with this w/ PureBasic 5.21 (x86 and x64) Beta 2 running under Windows 7.

Re: PB 5.21 b 2 - OpenNetworkConnection

Posted: Tue Nov 12, 2013 7:48 pm
by User_Russian
The problem was in the firewall ESET Smart Security.
Topic can be removed.