PB 5.21 b 2 - OpenNetworkConnection

Windows specific forum
User_Russian
Addict
Addict
Posts: 1597
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

PB 5.21 b 2 - OpenNetworkConnection

Post 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
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: PB 5.21 b 2 - OpenNetworkConnection

Post 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.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
User_Russian
Addict
Addict
Posts: 1597
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: PB 5.21 b 2 - OpenNetworkConnection

Post by User_Russian »

The problem was in the firewall ESET Smart Security.
Topic can be removed.
Post Reply