|
-
Feb 9th, 2000, 07:13 PM
#1
Thread Starter
New Member
I try to make a program in Visual Basic that runs in the server win NT when I make a session telnet ("telnet tomyserver") through SLNet server telnet version 2.5. for NT. Now we work in C, and we get the environment of SLnet with getenv API, we open the pipe of SLnet with open, write to slnet pipe with write API (over the handle of open API) and wait response with readconsoleinput API (over the handle of GetStdHandle(STD_INPUT)).
SeattleLab tell me that they cant support my software in Visual Basic, but only I asked them the basis to comunicate with their pipe. They tell me that I use named pipe and I have made this.
From Visual Basic, I have had success in connect with the pipe of the server telnet with createfile, and write it with writefile API.
But I still have'nt got to read from the pipe.I don't know why my program can't read from the telnet session and the readfile API doesn't work.This is the code that I have made. It`s more easy but the final part (readfile) doesn't work.
Please tell me nothing about it if you can. Thankyou
The code in Visual Basic
/////////////////////////////////////////////
name = "//./pipe/" + Environ("PIPENAME")
m_hPipe = CreateFile(name, GENERIC_READ + GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0)
'Open pipe success
txtdata = "Hello world" + Chr(10) + Chr(13)
For i = 1 To Len(txtdata)
Data(i - 1) = Asc(Mid(txtdata, i, 1))
Next i
bRet = WriteFile(m_hPipe, Data(0), Len(txtdata), BytesWritten, 0)
'write pipe success. Hello world appears in telnet sesion. Until here success
'read pipe doesn't work and in Visual Basic
'I cant use the readconsoleinput of Standard 'input like in C
outstr = ""
Do
lRet = ReadFile(m_hPipe, Buffer(0), 1, BytesRead, 0)
For i = 1 To BytesRead
outstr = outstr & (Chr(Buffer(i - 1)))
If Buffer(i-1)=13 Or Buffer(i-1)=10 Then
GoTo fuera
End If
Next i
Loop Until True
fuera:
txtdata = "ok" + Chr(10) + Chr(13)
For i = 1 To Len(txtdata)
Data(i - 1) = Asc(Mid(txtdata, i, 1))
Next i
bRet = WriteFile(m_hPipe, Data(0), Len(txtdata), BytesWritten, 0)
If m_hPipe <> 0 Then CloseHandle m_hPipe
---------------------------------------------
Best Regard. Thankyou
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
|