Login  
Search All Forums
Dart Home | PowerTCP Ping Enterprise for Ax | Custom Development Reply | PowerTCP Ping Enterprise Tool Topics | Forums   
AuthorForum: PowerTCP Ping Enterprise Tool
Topic: reply data
AlEdlund

From: Crystal Lake, IL USA
Posts: 26
Member Since: 06/25/04
posted November 5, 2004 12:37 PM

using the example ping async application and altering the echocomplete message to :

    Dim strOut As String
    strOut = e.remoteName + _
      " (" + e.remoteAddress + _
      "): " + e.elapsedTime.ToString() + _
      " milliseconds, " + _
      e.data.ToString()
....
      If (e.error = 0) Then
        addHistoryLine(strOut)

It shows as no text being received (system.byte[]_), the sniffer trace does show text returning..
am I perchance coding it incorrectly to view the return data?
tks,
Al
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted November 5, 2004 1:10 PM

To convert from byte array to string:

string s = System.Text.Encoding.Default.GetString((byte[])e.data);

To convert from string to byte array:

byte[] bytes = System.Text.Encoding.Default.GetBytes("Hello World!");
AlEdlund

From: Crystal Lake, IL USA
Posts: 26
Member Since: 06/25/04
posted November 5, 2004 2:23 PM

tony,
thanks again, what I ended up using was this
for encoding

    Dim uni As New UnicodeEncoding
    Dim strTest As String = "0123456789abcdef"
    Dim arrBytes As Byte() = uni.GetBytes(strTest)
and this for decoding

      Dim uni As New UnicodeEncoding
      Dim strTest As String = uni.GetString(e.data)

thanks again,
Al
Reply | PowerTCP Ping Enterprise Tool Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX