×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Nov 2006
    Location
    Chengdu China
    Posts
    169

    How to Detect End of Stream?

    Hi,
    I have an app that connects to a socket server on the internet. I use RSocket::RecvOneOrMore to read data from the network. the data is quite large so I keep calling this method. The pb is that how can I tell when the data transmission is finished?
    Of course, we can add some end flag at server side. but the server is from 3rd party, we can not change the data definition there.
    The server is originally designed for java client connection. In java, when we call InputStream.read(), it will return -1 if it meets the end of the stream.
    And I used Wireshark to cap the log, no idea how can I detect the end of stream of a TCP connection.
    Can anybody help me out here, many thx!

    Lance
    The dream is to become one machine, or let one machine become me

  2. #2
    Super Contributor
    Join Date
    Jul 2007
    Location
    ShenZhen, China
    Posts
    4,346

    Re: How to Detect End of Stream?

    Quote Originally Posted by lancemachine View Post
    Hi,
    I have an app that connects to a socket server on the internet. I use RSocket::RecvOneOrMore to read data from the network. the data is quite large so I keep calling this method. The pb is that how can I tell when the data transmission is finished?
    Of course, we can add some end flag at server side. but the server is from 3rd party, we can not change the data definition there.
    The server is originally designed for java client connection. In java, when we call InputStream.read(), it will return -1 if it meets the end of the stream.
    And I used Wireshark to cap the log, no idea how can I detect the end of stream of a TCP connection.
    Can anybody help me out here, many thx!

    Lance
    general, network protocol has a filed descripe data length, like http's content-length, and ip's length filed.

    if the server not the filed, it use a way notify client data is over, like InputStream.read() return -1, it means when server send finish the data, it will close the connection.

    so if you recv KErrEof event, it is server notify client finish-event.

    ps. this solution is not a good design, because has many reason, server need close the connection, so it will give you a mistake notify. so you'd better find the protocol has other way to notify you finish event.
    ----------------------------
    坚持学习, 坚持编码
    http://www.devdiv.net/
    qxiaoyuan

  3. #3
    Regular Contributor
    Join Date
    Nov 2006
    Location
    Chengdu China
    Posts
    169

    Re: How to Detect End of Stream?

    thx

    I detected the eof event, and everything works fine
    The dream is to become one machine, or let one machine become me

Similar Threads

  1. problem with end of file detect
    By masoud_bayat in forum Symbian
    Replies: 15
    Last Post: 2008-10-06, 08:45
  2. Detect VoIP call start and end
    By edison.ccc in forum VoIP
    Replies: 0
    Last Post: 2007-06-26, 05:52
  3. Nokia 6681 not able to find end of stream
    By krish.chauhan in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2006-12-06, 15:29
  4. Problem: 10 Bluetooth Ports simultaneously
    By Alco Fresh in forum Symbian
    Replies: 1
    Last Post: 2006-07-03, 12:05
  5. Half Duplex Audio Streaming
    By subhrajyotisaha in forum Symbian Media (Closed)
    Replies: 0
    Last Post: 2006-05-25, 04:39

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×