Page 1 of 1

ReceiveNetworkData() hangs + further missing things

Posted: Sat May 26, 2012 2:57 pm
by Andre
see code example + more missing/requested things on german forum:
http://www.purebasic.fr/german/viewtopi ... 19&start=6

Re: ReceiveNetworkData() hangs + further missing things

Posted: Sat May 26, 2012 10:21 pm
by chris319
From Google Translate:
If this code is executed, the program hangs up while arriving data or a disconnect event occurs, which in itself at the client usually does so can not be queried. Either the help file is wrong or the function.

Second IPv6
The help is that you can establish a connection via TCP. This works well with IPv6? If so, how can you read out the IP or when is the last incorporated in PB? If not, when it finally arrives? IPv6 is needed. Even the old Windows XP supports IPv6 for a long time already.

Third How many programmers in all languages ​​lacks many additional "parameter" in the network functions. PB makes it a nice simple case of network objects, which is great and so easy to use for a lot simpler and faster. But things like a server would bind to a specific IP/network card really important.

4th Disconnect Event
Why there are no clients in the PB disconnect event? As far as I have the exquisite, there is the such. In any case, there is an "additional code" of PureFan and dark (player) of the do just that. When completed, the PB

5th For new and advanced networking features and parameters should be questioned soon after the community desires. So it would be safe to use as PB connection IDs own sense that you can assign them by function/command data. It's best to connect a single pointer, which then shows on their own data to the connection. Then you need not even have its own connection management for the IDs.

6th General and summary:
I am grateful for the easy-to-use network functions, but as it stands, has been made ​​since 2005 in which nothing drann. Not only did I emfinde it as strongly as you make of all this next Lib. Above all, I would be very grateful since.

Re: ReceiveNetworkData() hangs + further missing things

Posted: Sun May 27, 2012 7:15 am
by moogle
Pretty much what I've been requesting for the network functions for a long time now :)

Re: ReceiveNetworkData() hangs + further missing things

Posted: Thu May 31, 2012 11:32 pm
by Toshy
problem:

Code: Select all

; server

If InitNetwork() = 0
  MessageRequester("Error", "Can't initialize the network !", 0)
  End
EndIf

Port = 6832

If CreateNetworkServer(0, Port)
  
  Repeat
    
    SEvent = NetworkServerEvent()
    
    If SEvent
      
      ClientID = EventClient()
      
      Select SEvent
          
        Case #PB_NetworkEvent_Connect
          
          MessageRequester("PureBasic - Server", "A new client has connected !", 0)
          
          
      EndSelect
    EndIf
    
  Until Quit = 1 
  
  CloseNetworkServer(0)
Else
  MessageRequester("Error", "Can't create the server (port in use ?).", 0)
EndIf

End   

Code: Select all


; client
If InitNetwork() = 0
  MessageRequester("Error", "Can't initialize the network !", 0)
  End
EndIf

Port = 6832
Repeat
  ConnectionID = OpenNetworkConnection("127.0.0.1", Port)
  Delay(1000)
Until ConnectionID > 0
If ConnectionID
  *DatenPuffer = AllocateMemory(100)
  Ergebnis = ReceiveNetworkData(ConnectionID, *DatenPuffer, 10) ; without received data programm wait forever
  MessageRequester("PureBasic - Client", "", 0)
  CloseNetworkConnection(ConnectionID)
Else
  MessageRequester("PureBasic - Client", "Can't find the server (Is it launched ?).", 0)
EndIf

End
by - chris - (german forum)

Code: Select all

; client
If InitNetwork() = 0
  MessageRequester("Error", "Can't initialize the network !", 0)
  End
EndIf

Port = 6832
Repeat
  ConnectionID = OpenNetworkConnection("127.0.0.1", Port)
  Delay(1000)
Until ConnectionID > 0
If ConnectionID  
  s = ConnectionID(ConnectionID)
  arg = 1
  ioctlsocket_(s, #FIONBIO, @arg)
  *DatenPuffer = AllocateMemory(100)
  Ergebnis = ReceiveNetworkData(ConnectionID, *DatenPuffer, 10) ; without received data programm wait forever
  MessageRequester("PureBasic - Client", "Ergebnis: " + Str(Ergebnis), 0)
  CloseNetworkConnection(ConnectionID)
Else
  MessageRequester("PureBasic - Client", "Can't find the server (Is it launched ?).", 0)
EndIf

End

Re: ReceiveNetworkData() hangs + further missing things

Posted: Fri Jun 08, 2012 1:38 am
by Toshy
My english ist very bad. unfortunately. google-translater helps only slightly.

how can i or we inform an speak with fred about the network lib? a lot of years no update. lots of bugs. no new functions or parameters.
ReceiveNetworkData(), ReveiveNetworkFile() an also SendNetworkData() not run (ever) right.
but i need the Networklib.

a lot of persons the german forum an in this english forum write an aks since years about error and wishes. but i find no information from the Purebasic-Team about the problems with the NetworkLib an the future.

in the german forum i write some problem about the lib an wrong informations in the help-file.

additional i notice that SendNetworkData() does not work as described in the help file an sometime blocks "forever" (till server closed).

what can i do, that fred say somehing to this things, removes the errors an upgrade some funktions?

thanks
Toshy (same name in german Forum)

Re: ReceiveNetworkData() hangs + further missing things

Posted: Tue Jun 26, 2012 4:19 pm
by auser
Toshy wrote:problem:
No bug. This is normal behaviour on blocking sockets. Insert the missing NetworkClientEvent() before your ReceiveNetworkData() and it should work well (because it should do the missing "select()" or "poll()" for you ;)). Don't use ReceiveNetworkData() until NetworkClientEvent() tells you it's save to read without blocking (or recv_() until your socket was found in the read list of select_()) if you use blocking sockets (which seems to be the default in PB on client function).