InetTransport.OnDisconnected
This event is used to notify the application that a connection with given peer has been closed.
[C++]
typedef void (STDCALLCONV *MCSocketDisconnectedEvent)(void* UserData, void* Sender,
MCSocketDir Direction,
char* RemoteHost,
unsigned short RemotePort);
void setOnDisconnected(MCSocketDisconnectedEvent Value, void * UserData = NULL);
MCSocketDisconnectedEvent getOnDisconnected(void * *UserData);
[Pascal]
property OnDisconnected: TMCSocketDisconnectedEvent;
TMCSocketDisconnectedEvent = procedure (Sender : TObject;
Direction : TMCSocketDir;
RemoteHost : string;
RemotePort : word) stdcall of object;
[VB6]
Private Sub IMCXInetTransportEvents.OnDisconnected(ByVal Direction As MCXControl.MCXSocketDir,
ByVal RemoteHost As String,
ByVal RemotePort As Long)
[ActiveX]
void IMCXInetTransportEvents.OnDisconnected(
[in] MCXSocketDir Direction,
[in] BSTR RemoteHost,
[in] long RemotePort);
[C#]
public MCSocketDisconnectedEvent OnDisconnected;
public delegate void MCSocketDisconnectedEvent(object Sender, MCSocketDisconnectedEventArgs Args);
public class MCSocketDisconnectedEventArgs : EventArgs
{
public MCSocketDir Direction,
public string RemoteHost,
public int RemotePort
}
[VB.NET]
Public Event OnDisconnected As MCSocketDisconnectedEvent
Public Delegate Sub MCSocketDisconnectedEvent(ByVal Sender As Object, ByVal Args As MCSocketDisconnectedEventArgs)
Public Class MCSocketDisconnectedEventArgs
Public Direction As MCSocketDir
Public RemoteHost As String
Public RemotePort As Integer
End Class
[Java]
public class MCTranslateAddressEvent {
public int getDirection();
public String getRemoteHost();
public int getRemotePort();
}
public abstract interface MCSocketDisconnectedListener {
public void socketDisconnected(MCSocketDisconnectedEvent e);
}
public void removeSocketDisconnectedListener(MCSocketDisconnectedListener l);
public void addSocketDisconnectedListener(MCSocketDisconnectedListener l);
[Java ME] MIDP 2.0 only
public class MCTranslateAddressEvent {
public int getDirection();
public String getRemoteHost();
public int getRemotePort();
}
public abstract interface MCSocketDisconnectedListener {
public void socketDisconnected(MCSocketDisconnectedEvent e);
}
public void removeSocketDisconnectedListener(MCSocketDisconnectedListener l);
public void addSocketDisconnectedListener(MCSocketDisconnectedListener l);
[Palm]
not implemented;
[DLL]
not implemented;
- 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
This event is used to notify the application that SocketTransport or HTTPTransport has closed connection with remote host.
The event is fired only if the connection was actually established and a handshake (for SocketTransport) was successful. Note, that if the application sets AllowConnection parameter of OnConnected event to false, OnDisconnected event is fired anyway.
The event is fired in context of transport thread (not messenger thread).
[Pascal] NOTE: Delphi/Kylix IDE creates an event handler automatically, but it misses "stdcall" modifier. If you do not place "stdcall" manually for event handler function, it will crash.
|