Allow Ascii character 0 in strings

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

I'd guess that multiple SendNetworkData() may be received out of order if you're unlucky.
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

No, TCP/IP ensures that the order is correct.
You may just receive the data in different sized chunks than it was sent.
quidquid Latine dictum sit altum videtur
EdzUp[SD]
Enthusiast
Enthusiast
Posts: 104
Joined: Thu Jun 26, 2008 10:53 pm
Location: Banstead, UK

Post by EdzUp[SD] »

ok :D
Lykaestria
User
User
Posts: 76
Joined: Wed Sep 17, 2008 3:10 am
Location: New Zealand

Post by Lykaestria »

freak wrote:...You may just receive the data in different sized chunks than it was sent.
Errrrmm, why? :shock:
EdzUp[SD]
Enthusiast
Enthusiast
Posts: 104
Joined: Thu Jun 26, 2008 10:53 pm
Location: Banstead, UK

Post by EdzUp[SD] »

I think its the way everything goes through the internet you just have to stick it in a buffer till you got the packet then process it, I will add a footer and header to each packet to get the information required to process the packets.
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Lykaestria wrote:
freak wrote:...You may just receive the data in different sized chunks than it was sent.
Errrrmm, why? :shock:
Because the data is just a stream of bytes. The other side cannot determine which data belongs to the same SendNetworkData() command.
You always receive the data that is currently available. That could be half of one send, or multiple ones together.
quidquid Latine dictum sit altum videtur
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Trond wrote:Global Longvariable.l
Global Floatvariable.f
Global DoubleVariable.d

SendNetworkData(ClientID, @Longvariable, 4)
SendNetworkData(ClientID, @FloatVariable, 4)
SendNetworkData(ClientID, @DoubleVariable, 8 )
Trond: Nice, I'm pinching that. :)
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
EdzUp[SD]
Enthusiast
Enthusiast
Posts: 104
Joined: Thu Jun 26, 2008 10:53 pm
Location: Banstead, UK

Post by EdzUp[SD] »

Freak maybe you can answer this one, will the data arrive in the same order it was sent? If not then sending a type would be pointless.
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

EdzUp[SD] wrote:Freak maybe you can answer this one, will the data arrive in the same order it was sent? If not then sending a type would be pointless.
Learn reading:
freak wrote:No, TCP/IP ensures that the order is correct.
bye,
Daniel
EdzUp[SD]
Enthusiast
Enthusiast
Posts: 104
Joined: Thu Jun 26, 2008 10:53 pm
Location: Banstead, UK

Post by EdzUp[SD] »

So basically sending a structure through the network is useless as if you have multiple values in that type it doesnt arrive correct so there is no way of knowing what is what:

For example sending:
ClientID.l, Class.l, Information.l

Could arrive as:
Class.l, Information.l, ClientID.l

hence useless, this is why I asked for the string thing in the first place as you could then pack everything into one string and send that over the network and read in what arrived. This is how the BlitzMax version of Elite Multiplayer worked and it worked fine, in PB I need the date to be in sequence as there could be as many as 256 players in one server and that would be a load of useless data flying around waiting for it to get into sequence.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

NOOOOO. At least not in TCP/IP.

Bytes arrive in the order you sent. You just don't know when they arrive and how many arrive in each batch.

So sending A.l B.l C.l means they arrive as A.l B.l C.l.

Period.

UDP is a different story.
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
EdzUp[SD]
Enthusiast
Enthusiast
Posts: 104
Joined: Thu Jun 26, 2008 10:53 pm
Location: Banstead, UK

Post by EdzUp[SD] »

THANK YOU blueznl thats all I needed to know :D
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

EdzUp[SD] wrote:THANK YOU blueznl thats all I needed to know :D
Freak said exactly the same: The order will be like you've sent it in TCP. I think you don't understand the comma symbol ",".
bye,
Daniel
EdzUp[SD]
Enthusiast
Enthusiast
Posts: 104
Joined: Thu Jun 26, 2008 10:53 pm
Location: Banstead, UK

Post by EdzUp[SD] »

I do know what a comma is thank you very much, what I wanted clarification on was the packets coming through.
Post Reply