陈抒
2013-12-05 16:20:55 UTC
Hi,
In my TCP server, server can send message to client under one of
following situations
1. one user fills in some text and clicks button on web site
2. server reads a message from a client and realizes it must send response
to client
Client always sends heartbeat message to TCP server every 50 seconds, and
it expects to get the heartbeat response message from TCP server.
So the interaction between Client and Server is not as simple as
request/response model.
Reading a message from client consists of two steps:
1. read header part, 5 bytes, the latter 4 bytes indicate the body's length
2. read body part
How to make sure the read operation work in a correct order? I hope server
app can read all messages one by one.
Do you have any best practice for this? Use a read queue for this?
Dean Chen
Best regards
http://blog.csdn.net/csfreebird
In my TCP server, server can send message to client under one of
following situations
1. one user fills in some text and clicks button on web site
2. server reads a message from a client and realizes it must send response
to client
Client always sends heartbeat message to TCP server every 50 seconds, and
it expects to get the heartbeat response message from TCP server.
So the interaction between Client and Server is not as simple as
request/response model.
Reading a message from client consists of two steps:
1. read header part, 5 bytes, the latter 4 bytes indicate the body's length
2. read body part
How to make sure the read operation work in a correct order? I hope server
app can read all messages one by one.
Do you have any best practice for this? Use a read queue for this?
Dean Chen
Best regards
http://blog.csdn.net/csfreebird