Restored from previous forum. Originally posted by pbdep.
Hello Fred,
I know I already emailed these for the 3.50 release but i hoped they
would be inside the next release.
Needed ( to finalise the Network )
1) GetRemoteIp & GetRemoteAddress, or remote peer ip & port.
2) NetworkClientEvent Missing case 4 : remote Server hungup !!!
3) Need to Bind CreateNetworkServer on other NIC's (not possible now)
Realy needed to above in PB, (in Linux and Windows)
Hope you will implement them for the next release...
Kind Regards, Pbdep..
[Implemented] New Features needed
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Fangbeast.
In case Fred's too busy to add it intot he next release, Pupil kindly provided the following bits of code to help me when designing a chat program.
Then you cave a callback and in there, you designate a case $9000 which is a server disconnect and you do what you like with it.
For getting the IP and port of the connection, you can do the following (also from Pupil)
Hope this is a good enough filler in the interim
We are Dyslexic of Borg, prepare to have your ass laminated!
In case Fred's too busy to add it intot he next release, Pupil kindly provided the following bits of code to help me when designing a chat program.
Code: Select all
If WSAAsyncSelect_(ConnectionID, WindowID(#Window_chatbox), $9000, #FD_CLOSE) = #SOCKET_ERROR
; If this happend we'll know when an server unexpectedly die on us
err.l = WSAGetLastError_() ; This line should be here even if we don't act on the result.
EndIf
For getting the IP and port of the connection, you can do the following (also from Pupil)
Code: Select all
Structure IPType ; Get connected client IP details (from Pupil)
Reserved.w
Port.w
StructureUnion
IPLong.l
IP.b[4]
EndStructureUnion
Zeros.l[2]
EndStructure
; In the main code somewhere...
ClientID = NetworkClientID() ; Get the client's connection id
length.l = SizeOf(IPType) ;
result.l = GetPeerName_(ClientID, @IP.IPType, @length)
If result = 0
ip$ = StrU(IP\IP[0], #Byte) + "." + StrU(IP\IP[1], #Byte) + "."
ip$ + StrU(IP\IP[2], #Byte) + "." + StrU(IP\IP[3], #Byte) + ":" + StrU(IP\Port, #Word)
user()\userip = ip$
Else
; result = WSAGetLastError_()
; Error handling.
EndIf
We are Dyslexic of Borg, prepare to have your ass laminated!
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by pbdep.
Yes.. its a nice example..but ->
*) Linux does not use Api's
*) Network part in PB should be enhanced
*) ClientNetworkEvent needs a case 4: server dropped session !!
*) Selectable BIND on IP addresses in Server mode is needed.
( PC with more then 1 ip addresses needs selectable bind)
And last of all, Need GetRemoteIp and GetRemotePort during incoming
client session running Servermode, not acceptable as Winsock API.
This needs to be a PureBasic Command, Thats far better...
Hope FRED implements it soon,
because the network part in PB is unfinished without the above.
Regards, Pbdep...
Yes.. its a nice example..but ->
*) Linux does not use Api's
*) Network part in PB should be enhanced
*) ClientNetworkEvent needs a case 4: server dropped session !!
*) Selectable BIND on IP addresses in Server mode is needed.
( PC with more then 1 ip addresses needs selectable bind)
And last of all, Need GetRemoteIp and GetRemotePort during incoming
client session running Servermode, not acceptable as Winsock API.
This needs to be a PureBasic Command, Thats far better...
Hope FRED implements it soon,
because the network part in PB is unfinished without the above.
Regards, Pbdep...