PowerTCP Emulation for .NETfrom $699.00
See all PowerTCP Emulation for .NET Code Examples
Receive and Display Data Example
The following example demonstrates receiving data in a Windows Forms environment. Data is read asynchronously, as it is available, without blocking the UI. The data is marshaled to the UI thread and written to the display.
private void button1_Click(object sender, EventArgs e)
//Receive data on a worker thread
private void receiveData(object notUsed)
//Receive data when it is sent by the remote host
//Marshal it to the UI for display
byte buffer = new byte;
while (telnet1.State != ConnectionState.Closed)
telnet1.Marshal(telnet1.Read(buffer, 0, 1024), "", null);
private void telnet1_Data(object sender, DataEventArgs e)
//Whenever data is received, display it
if (e.Data != null) vt1.Write(e.Data.Buffer, 0, e.Data.Count);
To download a trial please visit the PowerTCP Emulation for .NET product page.