CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2010
    Location
    .NET 3.5, VisualStudio-2008
    Posts
    30

    Regarding Socket

    Hi all,

    Here are some questions, plz kindly share your ideas on that

    1) Where should the socket be closed ideally? is it while closing the application or after receiving the response from the device.
    2) How to know if any data has arrived on the socket? is there any in-built function triggered on receiving some data on the socket?
    3) How do v know if the socket is already created?

    Thanks & Regards

    daffodils180

  2. #2
    Join Date
    May 2007
    Posts
    1,546

    Re: Regarding Socket

    1) Where should the socket be closed ideally? is it while closing the application or after receiving the response from the device.
    Neither. Close it when you're finished with it.

    2) How to know if any data has arrived on the socket? is there any in-built function triggered on receiving some data on the socket?
    Use the asynchronous socket methods. When your callback is invoked, data is available on the socket or the socket has been closed.

    3) How do v know if the socket is already created?
    Sockets can only be created once so if you get an exception creating the socket, it's already created.
    www.monotorrent.com For all your .NET bittorrent needs

    NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.

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