PureBasic and Network

For everything that's not in any way related to PureBasic. General chat etc...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by pbdep.


Hiya All,

I have some question on the Network part of PB.
I realy hope i can get some help on the explantion part on the below.

Question below are related to Linux and Windows, no API answers please.

*) Does receivenetworkstring() exists in PB 3.40 ?

*) How to use streaming data in PB.

*) How to retrieve remote ip/port from connected client when in server mode.

*) How to Bind to a specific IP address using PB. running a server.

*) Is Case 3 in networkserverevent() realy blocking the program or only
the current thread or event? or also the windows event?

*) How to read from Structure's like SOCKADDR_IN when connection in established?

*) Will UDP be provided in the future? Multicast and/or Broadcast?

*) Does a networkserverevent() handles current clientid 1 at the time or should clientID
still be checked in Case 2 / 3 / 4


Thats pritty it...:)

Greetings,
Norman.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by tranquil.



*) Does receivenetworkstring() exists in PB 3.40 ?

-> Due to network behavior you should code it yourselfe to be sure to receive your datas correctly. (Search the Tips & Tricks, Ive posted an example some months ago)

*) How to use streaming data in PB.

You can still done it due to a normal tcp/ip connection. But indeed, UDP will be better here if you want to stream audio or movie datas.

*) How to retrieve remote ip/port from connected client when in server mode.

I think I have posted an example here to. You should know the port the client has connected to. If you want I can post you the IP thingie here again if I'm at home.

*) How to Bind to a specific IP address using PB. running a server.

What do you mean with this? if you want you can use the Bind_() command to bind sockets.

*) Is Case 3 in networkserverevent() realy blocking the program or only
the current thread or event? or also the windows event?

For every networkevent I use WSAAsyncSelect_ to be shure not to be in blocked mode.

*) How to read from Structure's like SOCKADDR_IN when connection in established?

See the Tips & Tricks section. you will see it there. (Like the IP thingie, you can find the incomming client IP in this structure)

*) Will UDP be provided in the future? Multicast and/or Broadcast?

Fred? I'm not the only one who wants to get UDP support! :o)

*) Does a networkserverevent() handles current clientid 1 at the time or should clientID
still be checked in Case 2 / 3 / 4

clientids are the sockets allocated by windows. every connection has its own socket (clientid) and could not be the same as another connection. If you mean this.

Thats pritty it...:)



Tranquilizer/ Secretly!
http://www.secretly.de
Registred PureBasic User
System: Windows 2000 Server, 512 MB Ram, GeForce4200 TI 128 MB DDR, Hercules Theater 6.1 DTS Sound
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by pbdep.

Hi Tranq..

Thanks for the reply's ..pritty quick and clear.. :)
A little reply to your answers...

>>*) How to Bind to a specific IP address using PB. running a server.

>What do you mean with this? if you want you can use the Bind_() >command to bind sockets.

Basicly i ment How to bind the Server to a specific TCP/IP (NIC),
I have a machine with 3x a NIC and i want PB to bind only to the
one i select, sofar ive not been able to find out how to do this :wink:



>>*) Will UDP be provided in the future? Multicast and/or Broadcast?

>Fred? I'm not the only one who wants to get UDP support! :o)

There are now for sure 2 :wink:

Thanks a lot...

Regards,
Norman...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by turtle.
Originally posted by tranquil



*) Does receivenetworkstring() exists in PB 3.40 ?

-> Due to network behavior you should code it yourselfe to be sure to receive your datas correctly. (Search the Tips & Tricks, Ive posted an example some months ago)
Well, I was not able to find this in the Tricks and Tips section. It seems to be possible to send plain strings, but it is not possible to receive them. The ReceiveNetworkData returns a '-1' when you're trying to!

The only solution seems to be not using the "SendNetworkString" command, implement the socket communication with "-NetworkData", but then it is useless to have a "SendNetworkString" in PureBASIC at all, isn't it?

It would be great to have a "ReceiveNetworkString" implemented in PureBASIC!

Regards

Peter.


http://www.turtle.dds.nl
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

Hi, go to:
http://www.reelmediaproductions.com/pb/pbchat.html
and download the source files.
Paul is providing a neat little app for chat.
And the purpose of chat apps is to send strings...
Hope this helps.

BTW: don't know if Paul is using WinAPI so look at the code.

Have a nice day...

Franco
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by turtle.

Hey thanx!!! This source is really useful. And as you may have seen, the socket instructions used are indeed "ReceiveNetworkData" and "SendNetworkData".

Thanks again!

P.
Post Reply