Scrambled data using Winsocket Control in my Access Form

M

mike11d11

I tried using the windows winsocket control on my Access form and place
the recieved data in a text box. I got it to work but the data is
coming accross like ÿþ%ÿý and I cant use that information. Is
there a way to descramble this. I'm thinking it might have to do with
using some sort of emulation that can read the info. We have software
right now that connects to our server with VT101 emulation. If this is
what is making it readable how can I convert the data or use a
emulation in my form?
 
M

mike11d11

Actually I haven't even got that far as to send text out, this is just
scrambled data that i'm recieving when I connect. Normally in our
telnet software that came with our host system, when I connect it asked

me for my user name and password, I'm guessing this is what is coming
back accross to me but is unreadable, let me show you my code that i'm
using straight from Microsofts website. Let me know if you can see
where somehting might be incorrect.

Option Explicit
Const EchoPort = 23


Private Sub cmdConnect_Click()
Dim temp As String
temp = InputBox$("Enter a server name...", _
"Connect to the Echo Service", Winsock1.RemoteHost)
If temp <> "" Then
If Winsock1.State <> sckClosed Then Winsock1.Close
Winsock1.RemoteHost = temp
Winsock1.RemotePort = EchoPort
Winsock1.LocalPort = 0
Winsock1.Connect
End If
End Sub


Private Sub cmdDisconnect_Click()
If Winsock1.State <> sckClosed Then Winsock1.Close
cmdConnect.Enabled = True
cmdConnect.SetFocus
cmdDisconnect.Enabled = False


End Sub


Private Sub cmdEcho_Click()
Text1.SetFocus
Winsock1.SendData Text1.Text
cmdEcho.Enabled = False
End Sub


Private Sub Winsock1_Close()
If Winsock1.State <> 0 Then Winsock1.Close
End Sub


Private Sub Winsock1_Connect()
Text2.SetFocus
cmdConnect.Enabled = False
cmdEcho.Enabled = True
cmdDisconnect.Enabled = True
End Sub


Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)


Dim temp As String
temp = String(bytesTotal, "*")
Winsock1.GetData temp, vbString, bytesTotal
Text2.SetFocus
Text2.Text = temp
cmdEcho.Enabled = True
End Sub


Private Sub Winsock1_Error(ByVal Number As Integer, _
Description As String, _
ByVal Scode As Long, _
ByVal Source As String, _
ByVal HelpFile As String, _
ByVal HelpContext As Long, _
CancelDisplay As Boolean)
MsgBox "Error: " & Number & vbTab & Description, vbOKOnly, _
"Winsock Control 1 Error"
CancelDisplay = True
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top