Link to home
Start Free TrialLog in
Avatar of pcssecure
pcssecureFlag for Hong Kong

asked on

How to handke mutiple Winsock Clients messages?

Hi Experts,
My Delphi 6 application need to listen to a TCP port and respond to multi clients messages accordingly.

This is the protocol of the communication.

Connection Request from client , 16 bytes
A B C L 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

I need to respond with 16 bytes
A B C R  0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

Then Client will Send 16 + Commad No of Bytes which will be in 8 to 11
A B C L  0x00 0x00 0x00 0x00 8 9 10 11 0x00 0x00 0x00 0x00 ...

I need to respond this with same No of bytes
A B C R  0x00 0x00 0x00 0x00 8 9 10 11 0x00 0x00 0x00 0x00 ...

Finally  Disconnection from Client.
A B C L 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

I'm VERY new to winsock and TCP comunication. It would be very helpful if it is a detailed working sample.

When I use a Network Snipper WireShark the data for Connection looks is like this
41 42 43 4c 00 00 00 00 00 00 00 00 00 00 00 00

Thanks
PCSC
ASKER CERTIFIED SOLUTION
Avatar of Mike Littlewood
Mike Littlewood
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pcssecure

ASKER

I'm seeing something wrong in the format. So re-posting again.