
SendText method
Sends text message to remote peer.
Type
Integer.Syntax
- C#
- C++
- VB.NET
int devP2P.SendText(IntPtr Handle, int chanid, string text, bool reliable);
The SendText(Handle,chanid,text,reliable) syntax has these parts:
The SendText(Handle,chanid,text,reliable) syntax has these parts:
Handle | Reference to the devP2P instance. |
chanid | Integer that specifies channel index. |
text | String buffer to send. |
reliable | Determines if packet should be delivered in reliable way. Defaults to true. |
Return value | 0 (ErrorNone) if success, otherwise negative value from Errors enumeration. |
int SendText(int chanid, char *text, bool reliable = true);
The SendText(chanid,text,reliable) syntax has these parts:
The SendText(chanid,text,reliable) syntax has these parts:
chanid | Integer that specifies channel index. |
text | NULL terminated data buffer. |
reliable | Determines if packet should be delivered in reliable way. Defaults to true. |
Return value | 0 (ErrorNone) if success, otherwise negative value from Errors enumeration. |
Function P2P_SendText(ByVal Handle As IntPtr, ByVal chanid As Integer, ByVal text As String, ByVal reliable As Boolean) As Integer
The SendText(Handle,chanid,text,reliable) syntax has these parts:
The SendText(Handle,chanid,text,reliable) syntax has these parts:
Handle | Reference to the devP2P instance. |
chanid | Integer that specifies channel index. |
text | String buffer to send. |
reliable | Determines if packet should be delivered in reliable way. Defaults to true. |
Return value | 0 (ErrorNone) if success, otherwise negative value from Errors enumeration. |
Remarks
SendText will send NULL terminated text buffer to remote peer. On peer's side, TextReceived event will fire when text arrives. You can use this method only after connection with remote peer is established, of course.You should select one of 1024 available channels to send this message. Make sure that channel is not already used by file transfer, or channel forwarding. You can send more than one message through the channel, so usually you can pick channel 0 for messages of any kind.
If you did not specify reliable method, it is possible packet never reaches the destination. This makes sense for information that is not important and possibly will be resent (such as some status information you want to provide to remote side).
You will not get any confirmation that your message is delivered.
Platforms
WindowsMac OSX
Linux
BSD