
Stopped event
Fires when devP2P stops working and goes offline.
Syntax
- C#
- C++
- VB.NET
delegate void devP2P.StoppedEvent(IntPtr Handle, int errorno);
The Stopped(Handle,error) syntax has these parts:
The Stopped(Handle,error) syntax has these parts:
Handle | Reference to the devP2P instance. |
error | Errors value, ErrorNone if operation is successful, or other value defining the error that occurred. |
void Stopped(CP2P *p2p, Errors error);
The Stopped(p2p,error) syntax has these parts:
The Stopped(p2p,error) syntax has these parts:
p2p | Pointer to devP2P instance that fired the event. |
error | Errors value, ErrorNone if operation is successful, or other value defining the error that occurred. |
Delegate Sub P2P_StoppedEvent(ByVal Handle As IntPtr, ByVal errorno As Integer)
The Stopped(Handle,error) syntax has these parts:
The Stopped(Handle,error) syntax has these parts:
Handle | Reference to the devP2P instance. |
error | Errors value, ErrorNone if operation is successful, or other value defining the error that occurred. |
Remarks
This event fires when devP2P stops it's operation and goes offline, no matter if it was previously Connected to remote peer or not. If it stopped due to an error, Error argument will provide info about the error. If it was result of your call to Stop method, Error will be empty. You should now call Start method again to accept new connections.When devP2P successfully connects to remote peer, you cannot reuse same devP2P instance, so there is no Disconnect method in devP2P. If you decide you want to reconnect, you must use new devP2P instance (or Stop/Start current one) so internal buffers are cleared. Otherwise, devP2P could be left in unknown state - dealing with mediator, local UDP/TCP listening sockets etc..
To use this event, you should implement function by yourself in the code (based on function declaration), and set devP2P.Events.Stopped structure member to point to your function.
Code sample
- C++
void p2p_Stopped(devP2Plib::CP2P *p2p, devP2Plib::Errors error)
{
printf("%s] Stopped, error %s\r\n", p2p->MyName, p2p->ErrorText(error));
}
int main(int argc, char **argv)
{
/* ... */
devP2Plib::CP2P *p1 = devP2Plib::CP2P::Create();
/* ... */
p1->Events.Stopped = p2p_Stopped;
/* ... */
}
{
printf("%s] Stopped, error %s\r\n", p2p->MyName, p2p->ErrorText(error));
}
int main(int argc, char **argv)
{
/* ... */
devP2Plib::CP2P *p1 = devP2Plib::CP2P::Create();
/* ... */
p1->Events.Stopped = p2p_Stopped;
/* ... */
}
Platforms
WindowsMac OSX
Linux
BSD