Dart.PowerTCP.EmailValidation Namespace > Datagram Class : ToString Method (Datagram) |
Returns all data sent/received as a string.
[Visual Basic]
Overrides Public Function ToString() As String
[C#]
public override string ToString();
[C++]
public: string* ToString(); override
[C++/CLI]
public:
String^ ToString(); override
A string representing all data sent or received.
The following example demonstrates sending some datagrams to an echo server and receiving the datagrams from the echo server.
[Visual Basic]
Dim iterations as Integer = 3
' Listen on the default interface and an ephemeral port.
udp1.Open()
' Send several datagrams
Dim s as String = "test"
Dim i as Integer
For i=0 to iterations
Udp1.send(s, "MyEchoServer", 7)
Next
' receive the echoed datagrams, there should be 3...requiring 3 Udp.Receive calls.
For i=0 to iterations
Dim d as Datagram = Udp1.Receive(s.Length)
Debug.WriteLine(d.ToString())
Next
'* Output
'* ------------------------
'* test
'* test
'* test
'* ------------------------
'*
[C#]
int iterations = 3;
// Listen on the default interface and an ephemeral port.
udp1.Open();
// Send several datagrams
string s = "test";
for(int i=0; i<iterations; i++)
udp1.send(s, "MyEchoServer", 7);
// receive the echoed datagrams, there should be 3...requiring 3 Udp.Receive calls.
for(int i=0; i<iterations; i++)
{
Datagram d = udp1.Receive(s.Length);
Debug.WriteLine(d.ToString());
}
/* Output
* ------------------------
* test
* test
* test
* ------------------------
*/
Platforms: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP, Windows Server 2003, Windows Vista
Datagram Class | Datagram Members
Send comments on this topic.
Documentation version 1.0.3.0.
© 2008 Dart Communications. All rights reserved.