Windows Vista Forums

System.Net.Sockets class
  1. #1


    Alain Dekker Guest

    System.Net.Sockets class

    Hi,



    I've created a socket like this:

    ipAddress = ipAddress.Parse(strAddress)
    ipRemoteEP = New IPEndPoint(ipAddress, nPort)

    m_Socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream,
    ProtocolType.Tcp)
    m_Socket.BeginConnect(ipRemoteEP, AddressOf ConnectCallback, m_Socket)

    and that all works fine (ie. the ConnectCallBack function is called when the
    connection is made). However, I've hit a snag: How do I get signalled when
    the remote server disconnects (crashes/shuts down/closes the
    connection/etc)?

    Thanks,
    Alain



      My System SpecsSystem Spec

  2. #2


    Tom Shelton Guest

    Re: System.Net.Sockets class

    On 2010-02-13, Alain Dekker <abdekker@newsgroup> wrote:

    > Hi,
    >
    > I've created a socket like this:
    >
    > ipAddress = ipAddress.Parse(strAddress)
    > ipRemoteEP = New IPEndPoint(ipAddress, nPort)
    >
    > m_Socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream,
    > ProtocolType.Tcp)
    > m_Socket.BeginConnect(ipRemoteEP, AddressOf ConnectCallback, m_Socket)
    >
    > and that all works fine (ie. the ConnectCallBack function is called when the
    > connection is made). However, I've hit a snag: How do I get signalled when
    > the remote server disconnects (crashes/shuts down/closes the
    > connection/etc)?
    >
    You don't... That's because that's how tcp/ip is implemented. You know when
    the remote host is down when you do a receive on the socket and it returns 0.

    --
    Tom Shelton

      My System SpecsSystem Spec

System.Net.Sockets class problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Class system.diagnostic.logfile error Shay Levy [MVP] PowerShell 0 20 Nov 2008
Class system.diagnostic.logfile error S.Boris PowerShell 1 20 Nov 2008
System Sockets and Winsock in VB6 MartinTeefy .NET General 0 28 May 2008
How to initialize an instance of a WMI System.Management.ManagementClass class Clint Bergman PowerShell 5 01 Aug 2007
Problems sending data with System.Net.Sockets.Socket Coviti PowerShell 0 14 Jun 2007