Discuss this help topic in MsgConnect Forum

Filter: C++  Pascal  C#  VB.NET  Java  Java ME  ActiveX  DLL 



InetTransport.OnConnected

InetTransport     See also    


This event is used to notify the application that a connection with given peer is available.

Declaration

[C++]
    typedef void (STDCALLCONV *MCSocketConnectedEvent)(void* UserData, void* Sender, MCSocketDir Direction, char* RemoteHost, unsigned short RemotePort, bool& AllowConnection);
    void setOnConnected(MCSocketConnectedEvent Value, void * UserData = NULL);
    MCSocketConnectedEvent getOnConnected(void * *UserData);

[Pascal]
    property OnConnected: TMCSocketConnectedEvent;
    TMCSocketConnectedEvent = procedure (Sender : TObject; Direction : TMCSocketDir; RemoteHost : string; RemotePort : word; AllowConnection : boolean) of object;

[VB6]
    Private Sub IMCXInetTransportEvents.OnConnected(ByVal Direction As MCXControl.MCXSocketDir, ByVal RemoteHost As String, ByVal RemotePort As Long)

[ActiveX]
    void IMCXInetTransportEvents.OnConnected( [in] MCXSocketDir Direction, [in] BSTR RemoteHost, [in] long RemotePort, [out] VARIANT_BOOL* AllowConnection);

[C#]
    public MCSocketConnectedEvent OnConnected;
    public delegate void MCSocketConnectedEvent(object Sender, MCSocketConnectedEventArgs Args);
    public class MCSocketConnectedEventArgs : EventArgs
    {
        public MCSocketDir Direction,
        public string RemoteHost,
        public int RemotePort,
        public bool AllowConnection;
    }

[VB.NET]
    Public Event OnConnected As MCSocketConnectedEvent
    Public Delegate Sub MCSocketConnectedEvent(ByVal Sender As Object, ByVal Args As MCSocketConnectedEventArgs)
    Public Class MCSocketConnectedEventArgs
        Public Direction As MCSocketDir
        Public RemoteHost As String
        Public RemotePort As Integer
        Public AllowConnection As Boolean
    End Class

[Java]
    public class MCSocketConnectedEvent {
        public int getDirection();
        public String getRemoteHost();
        public int getRemotePort();
        public boolean getAllowConnection();
        public void setAllowConnection(boolean value);
    }
    public abstract interface MCSocketConnectedListener {
        void socketConnected(MCSocketConnectedEvent e);
    }
    public void removeSocketConnectedListener(MCSocketConnectedListener l);
    public void addSocketConnectedListener(MCSocketConnectedListener l);

[Java ME]
    public class MCSocketConnectedEvent {
        public int getDirection();
        public String getRemoteHost();
        public int getRemotePort();
        public boolean getAllowConnection();
        public void setAllowConnection(boolean value);
    }
    public abstract interface MCSocketConnectedListener {
        void socketConnected(MCSocketConnectedEvent e);
    }
    public void removeSocketConnectedListener(MCSocketConnectedListener l);
    public void addSocketConnectedListener(MCSocketConnectedListener l);

[DLL]
    not implemented;

Parameters

  • UserData - application-defined data that is passed back to the callback function.
  • Direction - specifies whether the connected sockets was initiating or accepting connection
  • RemoteHost - contains IP address of remote socket
  • RemotePort - contains port number of the remote socket
  • AllowConnection - Set this parameter to false to force disconnection of the socket

Description

    This event is used to notify the application that SocketTransport or HTTPTransport has established connection with remote host. The application may prevent further message exchange by setting AllowConnection parameter to false.

    The event is fired after handshake (for SocketTransport) is done.

    NOTE: The event is fired in context of transport (worker) thread (not messenger thread).

See also:     OnDisconnected    

Discuss this help topic in MsgConnect Forum