Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Winsock Problem

Status
Not open for further replies.

GDX

Programmer
Jun 4, 2000
186
US
Guys i have a problem, i am working on a telnet server using the MS Winsock Control, take a look at this code...

Private Sub WinsockServer_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim indata As String
indy = Index
WinsockServer(indy).GetData indata
If indata = "help" Then
If WinsockServer(indy).State = 7 Then
WinsockServer(indy).SendData ("In order to use blah blah")
End If
End If

You see the problem is when people using a telnet client it sends data to the server after each keystroke so i can't really read when they type "help" because it only reads as h then e then l then p and so on, any ideas on how to do this? I remeber i fixed this in the past but i forgot what I did :)
Gordon R. Durgha
gd@vslink.net
 
You can try reading when the number of bytes recibed, ex

Private Sock_DataArrival(...=

if bytestotal = 4 then

read

end if

or

Sock.PeekData

This don't delete the data from the buffer then you can read until you want and use a GetData to clean a buffer

If this this don't help you let me know





 
That works but thats only half my problem :( how do i detect when the user on the telnet client hits enter?
Gordon R. Durgha
gd@vslink.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top