PDA

View Full Version : Sending mulitple messages using tcpClient/tcpServer



yassersoft
16-09-2009, 05:15 PM
Hello every pascal game programmer. My problem is with the tcpClient and tcpServer components. I cant send or receive more than 1 line of message using Send() function. Fox example:
I want the server always send to all players my current position on two line of text posx and posy. But that don¬Ąt happend. Could you help me, please

User137
16-09-2009, 05:30 PM
Hello every pascal game programmer. My problem is with the tcpClient and tcpServer components. I cant send or receive more than 1 line of message using Send() function. Fox example:
I want the server always send to all players my current position on two line of text posx and posy. But that don¬Ąt happend. Could you help me, please

If you are sending strings, maybe use 1 line at the time but something like this
send( format('%d;%d',[posx,posy]) );
You will just need to parse where the ';' is and read integers next to them.

But because games send much more kinds of msgs, you may need to send more info like type of message
send( format('POS;%d;%d',[posx,posy]) );

chronozphere
16-09-2009, 07:59 PM
If you want to send alot of data, It would be better to use a binary representation. Strings are very "user-friendly", but can make things bloated in the end. It also requires more code to parse and handle errors. :)

And I would suggest you use a more descriptive topic title next time. Titles like "I need help" will not make others help you more quickly. :no:

Traveler
16-09-2009, 08:29 PM
Yassersoft, I have modified your thread title to something more appropriate. In the future try to use more descriptive titles which match your problem.