Page 1 of 1
Networking Question
Posted: Sun Sep 12, 2004 6:10 pm
by berklee
Is there a way to identify someone's IP address using the PB network library? I'm working on a server and would like to incorporate that information into some session management.
Oh - also...
Posted: Sun Sep 12, 2004 6:11 pm
by berklee
I'm also wondering - if I were to leave the server as single-threaded, would the network requests be queued?
Posted: Sun Sep 12, 2004 7:02 pm
by Shannara
The network library for PB is currently unfinished. It's one of the libraries in PB that have not been finished. So, your best bet is to use a third party network library, especially if you want to do ANY kind of server programming..
A good one can be found @
http://www.gnetlibrary.org/
strange
Posted: Sun Sep 12, 2004 7:15 pm
by berklee
I've noticed in the last couple of releases that the network library hasn't had much work done to it.
Has it been abandoned?
Posted: Sun Nov 28, 2004 10:29 pm
by berklee
Sorry, just thought I'd bump this thread - I'm really curious to know.
Is the Networking Library something that we should not expect to be completed?
Posted: Sun Nov 28, 2004 10:43 pm
by Shannara
Not to be negative here, but Im trying to remember what was happening in my last post. I believe there was missing disconnect state. And cannot send strings w/o a delay of one millisecond coded in after or before the send. Or the string doesnt send.
Anyways, I think the client side is almost there

The server side leaves a bit to be desired. However, hopefully it'll be complete around PB 4.0

Posted: Mon Nov 29, 2004 9:12 am
by Tranquil
Hm, what is the problem of the network-lib? it has all you need to create a server/ client.
Posted: Mon Nov 29, 2004 9:55 am
by HeX0R
The network-lib is terrible buggy!
I had lots of problems with it a while ago...
The following code wasn't running on a Win98SE Machine, runs with an inacceptable lag of 10 or 12 seconds on another Win98 Machine and runs like hell on a winXP PC :
Code: Select all
#Port = 1024
If InitNetwork()
If CreateNetworkServer(#Port)
netid = OpenNetworkConnection("127.0.0.1", #Port)
If netid
MessageRequester("Info", "O.K.", 0)
CloseNetworkConnection(netid)
End
EndIf
MessageRequester("Info", "Error", 0)
End
EndIf
MessageRequester("Info", "No Server", 0)
Else
MessageRequester("Info", "No Network", 0)
EndIf
After getting nothing but nonsense answers (in the german board) i decided to use the Winsock-Api, which runs just smooth on any win-version...
Posted: Mon Nov 29, 2004 12:16 pm
by Tranquil
Hm, many month ago I thought that Fred said, that the PB Network commands are nothing more then wrappers to the Windows API.
Very crrazy your problem.
Mike
Posted: Mon Nov 29, 2004 12:26 pm
by Num3
Yeah...
I miss some stuff on the Network library...
A bloody ping ...
PingClient(ip)
Some sort of DNS trace...
DNSTrace(ip) [this would be great for RBL spam checks]
Posted: Mon Nov 29, 2004 12:32 pm
by berklee
For me, it started because I wanted to create a server with the PB Networking library.
Although I can manage the sessions with multiple users, I wanted to be able to track IPs as well.
Posted: Mon Nov 29, 2004 4:53 pm
by DarkDragon
Code: Select all
InitNetwork()
Procedure.s GetIP(Host$, File$, _Data$)
File$ = "/ip.php"
ConnectionID = OpenNetworkConnection("bradan.i-networx.de", 80)
If ConnectionID
String$ = ""
String$ + "GET " + File$ + " HTTP/1.1" + Chr(13) + Chr(10)
String$ + "Host: " + Host$ + Chr(13) + Chr(10)
String$ + "Content-Type: application/x-www-form-urlencoded" + Chr(13) + Chr(10)
String$ + "Connection: close" + Chr(13) + Chr(10)
String$ + Chr(13) + Chr(10)
SendNetworkString(ConnectionID, String$)
While NetworkClientEvent(ConnectionID) <> 2
Delay(1)
Wend
*Buffer = AllocateMemory(50000)
ReceiveNetworkData(ConnectionID, *Buffer, 50000)
Text.s = PeekS(*Buffer)
FreeMemory(*Buffer)
Text = ReplaceString(Text, Chr(13), Chr(10))
Start = FindString(Text, Chr(10)+Chr(10)+Chr(10)+Chr(10), 1)+8
CloseNetworkConnection(ConnectionID)
Text = Mid(Text, Start+1, (Len(Text)-Start))
Text = Left(Text, FindString(Text, Chr(10), 1)-1)
ProcedureReturn Text
EndIf
EndProcedure
Debug GetIP("bradan.i-networx.de", "/ip.php", "")