
StartForward method
Starts port forwarding for specific forward channel.
Type
Integer.Syntax
- C#
- C++
- VB.NET
int devP2P.StartForward(IntPtr Handle, int index);
The StartForward(Handle,index) syntax has these parts:
The StartForward(Handle,index) syntax has these parts:
Handle | Reference to the devP2P instance. |
index | Index of the forwarded channel. |
Return value | 0 (ErrorNone) if success, otherwise negative value from Errors enumeration. |
int StartForward(int index);
The StartForward(index) syntax has these parts:
The StartForward(index) syntax has these parts:
index | Index of the forwarded channel. |
Return value | 0 (ErrorNone) if success, otherwise negative value from Errors enumeration. |
Function P2P_StartForward(ByVal Handle As IntPtr, ByVal index As Integer) As Integer
The StartForward(Handle,index) syntax has these parts:
The StartForward(Handle,index) syntax has these parts:
Handle | Reference to the devP2P instance. |
index | Index of the forwarded channel. |
Return value | 0 (ErrorNone) if success, otherwise negative value from Errors enumeration. |
Remarks
devP2P supports 32 forwarding channels you can setup, and each of them can provide (in theory) unlimited number of connection. For example, one such channel would be to forward local port 80 to remote peer's port 80. Once such channel is setup and started, any number of users can connect to local port, which will be redirected to remote. All of these connections belong to one channel.By default all channels are setup to do nothing. When you want to enable one of forwarding channels, you should get reference to CP2PForward object at given index (allowed 0-31) using GetForward method, set up it's properties, and then call this method to enable it and start it. When you're done using this channel, you can call StopForward.
As users connect and start using the channel, devP2P will always assign first free channel higher than 100 to route packets for the user. When connection with that user is closed, channel will be freed. It is, because of this, suggested NOT to use channels higher than 100 for your own data and text messages.
Code sample
- C++
devP2Plib::CP2PForward *f = devP2P->GetForward(0);
if (f)
{
f->Type = devP2Plib::TCPSocksProxy;
strcpy(f->LocalAddress, "127.0.0.1");
f->LocalPort = 1080;
success = p1->StartForward(0);
}
if (f)
{
f->Type = devP2Plib::TCPSocksProxy;
strcpy(f->LocalAddress, "127.0.0.1");
f->LocalPort = 1080;
success = p1->StartForward(0);
}
Platforms
WindowsMac OSX
Linux
BSD