network lib ?
-
- Enthusiast
- Posts: 237
- Joined: Tue Apr 05, 2005 11:20 pm
network lib ?
hi i need a net lib for tcp or udp
i need to make like 30 servers in my program i can not do this with pbs lib
no i do not have pb full i use the demo
is there any lib ?
i need to make like 30 servers in my program i can not do this with pbs lib
no i do not have pb full i use the demo
is there any lib ?
my english is horribel i know - SORRY i am dyslexic - i uses pb 3.94
Is that true, you need to call into the native platform's API for server network event handling??? PB's Network lib doesn't handle network events for us??? Bummer, I thought it did ...Tranquil wrote:...BUT if you want to code a server you will STRONGLY need the full version of PB couse you need API for your event handling.
Even a server is VERY hard to code.

I used PB3.xx to create multiple server instances in one process. Runs fine but you need API to do it.
How does PB Catches network events? You need to use WSAsyncSelect() to bind the sockets messages to a windows message queue.
The only way in PB for now is to "pool" network messaged. But thats not very smart on both sides: server and client.
How does PB Catches network events? You need to use WSAsyncSelect() to bind the sockets messages to a windows message queue.
The only way in PB for now is to "pool" network messaged. But thats not very smart on both sides: server and client.
Tranquil
-
- Addict
- Posts: 2344
- Joined: Mon Jun 02, 2003 9:16 am
- Location: Germany
- Contact:
You can bind multiple ports to one program in Pb 4.0 easily on the servesie tahts a fact, you can't specify the ip on the client side, true but I never encountered any case where this would be needed, maybe there are some rare cases with multiple network connections (card, wifi and LAn or something like that) but even there windows is verry likely to do it correct on both network adapters without a code change. And yes the event capturiong is done by pb and no I don't think it uses async sockets, but the peek flag in a blocking recv api command, as the UDP Lib did. The only real problem with the PB network lib is that its not verry efective because you have to manage all events in one thread, but this is more advanced stuff and not needed for simple purpose servers. If you don't believe me visit the Link(sorry it's german but the Download is on the frontpage) in my signature, downlaod our Messenger Client (100% PB) and test how perfectly it works together with our Server (100% PB up since 15 days, without any problem (it's also one of the Cross Platform PB programs since it compiles and works both under windows and linux)). It's true I'm currently working on replacing the Server with one written in C++ but thats only bbecause of the multithreading problems and for learning C++.
EDIT: Yes! It's hjard to write a stable server but thats not because of pbs libray limitations but because of reliability and the Design of the TCP/IP protocoll wich will split big messages in chuncks though they are garantied to come in the right order you will have to collect the data chunks until you have your complete message, file whatever and handling this can be verry tricky
EDIT: Yes! It's hjard to write a stable server but thats not because of pbs libray limitations but because of reliability and the Design of the TCP/IP protocoll wich will split big messages in chuncks though they are garantied to come in the right order you will have to collect the data chunks until you have your complete message, file whatever and handling this can be verry tricky
Last edited by Nik on Sun Mar 05, 2006 6:41 pm, edited 1 time in total.
Visit www.sceneproject.org
Better read his post again, he wants multiple servers, no multiple IPs. You can open any number of servers on different ports, it's not a problem.Shannara wrote:If he is talking about bounding an multiple IPs to his program, it is impossible with the PB network library. He would have to use the winsock API. Im actually waiting for his clarification reply
Nik: Business workstations usually have multiple IP addresses bound to them
Another instance sould be server applications.
Fred: Ah, that makes sense then
When I read his post concerning 30 servers in his one application, I assumed he wanted server grade. Thanks for the heads up- and my re-read. I gotta read more carefully.

Fred: Ah, that makes sense then

Let me quote the Linux man pages, since Windows copied the Network functions it shoulw be the same:
As PB surely uses INADDR_ANY you cann access every network interface avaible to the computer over the OpenNetworkConnection command and your servers created with CreateServer() should also be accesible form every interface availale.When INADDR_ANY is specified in the bind call the socket will be bound to all local interfaces.
Visit www.sceneproject.org
No. That is where I disagree due to real world examples. IRC Servers should only be bound to specific IPs, same with Email Servers, FTP servers, Torrent servers, game servers, the list goes on.
The thing is, if you have server software, in most cases, it would have multiple IP addresses assigned to it. You only want software to respond to the proper IP addresses. More information can be found @ http://www.purebasic.fr/english/viewtop ... highlight=
The thing is, if you have server software, in most cases, it would have multiple IP addresses assigned to it. You only want software to respond to the proper IP addresses. More information can be found @ http://www.purebasic.fr/english/viewtop ... highlight=