CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2002
    Location
    Germany
    Posts
    487

    TCP receive question

    Hi!

    In my application a use a serial interface for communication. This interface allows sending bytes and (NECCESSARY) calls a function as soon as an event happend on the line.

    So receiving is easy: as soon at least character has arrived, th function gets called and I can process the data.

    Now I want to archieve the same for TCP-connection. But until now I could'nt find such a called function. I would have to call recv() in a loop and analyze after that the result.

    Is there any way to make the workflow as it is with the serial intrerface?


    Thanks!

    Marc

  2. #2
    Join Date
    Jan 2003
    Location
    Timisoara, Romania
    Posts
    306

    Re: TCP receive question

    Quote Originally Posted by Marc from D
    Now I want to archieve the same for TCP-connection. But until now I could'nt find such a called function. I would have to call recv() in a loop and analyze after that the result.
    recv() functions gets data in a char buffer. So the ideea of calling it in a loop and it's analysis afther that it's the only way to find the results.

    I guess that this it's the only ideea, cause TCP is not a serial (it's not a bit by bit... communication protocol), so this function and the TCP protocol should not offer you the possibility to test a bit in the receiving moment.
    Last edited by Maximus_X; August 22nd, 2006 at 07:01 AM.

  3. #3
    Join Date
    Oct 2005
    Location
    Bangalore
    Posts
    1,051

    Re: TCP receive question

    you can implement it in the same way using WaitForSingleObject
    - Sreehari
    "Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us."
    " Everybody is sent to Earth on a purpose. I am so Lagging behind that i won't die." – Calvin

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured