|
-
Aug 12th, 2009, 04:33 AM
#1
Thread Starter
New Member
Microsoft TCP Winsock GetData() issue
Hi guys
I'm pretty new to VB programming and am in the middle of developing an application to receive data over a TCP connection.
To test the application, I am connection to the port using Telnet from the Windows command prompt.
If I copy some data onto the clipboard (for example "ABCDEFG" and then paste it into the telnet session, the only data that gets received into the application and subsequently displayed in the window is the letter "A" (I.e the first character in the string that was sent.
What am I doing wrong? How do I get it to accept the whole string ?
Here is the code....
=========================================================
Private Sub Listener_DataArrival(ByVal bytesTotal As Long)
Dim MBMinitiator As String
Listener.GetData MBMinitiator
Listener.Close
'
MBMContent = MBMinitiator
Label1.Caption = MBMContent
'
Listener.Listen
End Sub
=========================================================
Thanks in advance..
-
Aug 14th, 2009, 04:54 PM
#2
Re: Microsoft TCP Winsock GetData() issue
Label1.Caption = MBMContent
should be:
Label1.Caption = & Label1.Caption & MBMContent
Also, don't close the connection in the DataArrival() event...
-
Aug 15th, 2009, 06:23 AM
#3
Thread Starter
New Member
Re: Microsoft TCP Winsock GetData() issue
Hi DigiRev
Thanks for your help. I am getting more than 2 character being received now thanks. However, the results are not consistent.
For example, I sent the string "ABCDEFGHIJKLMNOPQRSTUVWXYZ" and the first file contained "XYZ". I sent it a second time and the file contained "Z".
From setting breakpoints, it seems that the DataArrival() functon is called 26 times when "ABCDEFGHIJKLMNOPQRSTUVWXYZ" is sent.
How can I determine when receving data is complete?
Thanks again
Neil
-
Aug 18th, 2009, 09:32 PM
#4
Re: Microsoft TCP Winsock GetData() issue
That's just the way telnet works. You should read up on the Telnet Protocol.
I may be able to write an example later if you still need help...
-
Aug 20th, 2009, 11:01 AM
#5
Thread Starter
New Member
Re: Microsoft TCP Winsock GetData() issue
Hi DigiRev
I'm having trouble making sense of the the way that Telnet works to be honest.
An example would be fantastic fi you have time please. I would really appreciate that.
Many thanks for your help.
-
Aug 26th, 2009, 06:09 AM
#6
Member
Re: Microsoft TCP Winsock GetData() issue
Try writing a simple form that acts as a client and try sending data that way.
Try this... (just copy and paste)
Private Sub Listener_DataArrival(ByVal bytesTotal As Long)
Dim MBMinitiator As String
Listener.GetData MBMinitiator, vbstring
Label1.Caption = label1.caption & MBMinitiator
End Sub
Oh, and I think you are having problems with Telnet because it runs in DOS. When you paste in DOS it sends it as keystrokes.
rudyking.gmail@com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|