开发者

Problem with connection.readln waiting for carriage return

I'm facing problem with TCpindy connection.readln method , I had no control in the other side sending data , when using Readln method in server side application hang (because receiving data don't contain carrige开发者_JAVA百科 return ) , i'm trying readstring method but without success Is there any suggestion to encouter this problem , me be looking for other component rather than indy ,

I need to get data from other client (tcp connection ) without any information about size of receiving data and without carriage return at the end of each frame.


You have to know how the data is being sent in order to read it properly. TCP is a byte stream, the sender needs to somehow indicate where one message ends and the next begins, either by:

  1. prefixing each message with its length

  2. putting unique delimiters in between each message

  3. pausing in time between each message

Indy can handle all of these possibilities, but you need to identify which one is actually being used first.

Worse case scenerio, use the CurrentReadBuffer() method, which returns a String of whatever raw bytes are available at that moment.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜