Click here to Skip to main content
15,914,444 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Multiple Form problems Pin
Achithyn11-Aug-04 9:45
Achithyn11-Aug-04 9:45 
GeneralDataGridView Pin
mtone10-Aug-04 15:34
mtone10-Aug-04 15:34 
QuestionIs it possible to do this? Pin
Lisana10-Aug-04 14:55
Lisana10-Aug-04 14:55 
AnswerRe: Is it possible to do this? Pin
Nick Seng10-Aug-04 15:24
Nick Seng10-Aug-04 15:24 
GeneralRe: Is it possible to do this? Pin
Lisana10-Aug-04 15:52
Lisana10-Aug-04 15:52 
GeneralRe: Is it possible to do this? Pin
Nick Seng10-Aug-04 16:09
Nick Seng10-Aug-04 16:09 
GeneralRe: Is it possible to do this? Pin
Lisana11-Aug-04 3:24
Lisana11-Aug-04 3:24 
GeneralTCP / Telnet client Pin
sybux200010-Aug-04 10:28
sybux200010-Aug-04 10:28 
Hi,

i'm trying to write a little telnet client in vb.net and I'm going crasy with it.

here is the main code :
   Private Function sendReceiveTCP(ByVal message As String) As String<br />
        Try<br />
            ' Translate the passed message into ASCII and store it as a Byte array.<br />
            Dim data As [Byte]() = System.Text.Encoding.ASCII.GetBytes(message)<br />
<br />
            ' Get a client stream for reading and writing.<br />
            '  Stream stream = client.GetStream();<br />
            Dim stream As System.net.Sockets.NetworkStream = msocket.GetStream()<br />
<br />
            ' Send the message to the connected TcpServer. <br />
            stream.Write(data, 0, data.Length)<br />
<br />
            Console.WriteLine("Sent: {0}", message)<br />
<br />
            ' Receive the TcpServer.response.<br />
            ' Buffer to store the response bytes.<br />
            data = New [Byte](100000) {}<br />
<br />
            ' String to store the response ASCII representation.<br />
            Dim responseData As [String] = [String].Empty<br />
<br />
            ' Read the first batch of the TcpServer response bytes.<br />
            Dim bytes As Int64 = stream.Read(data, 0, data.Length)<br />
            responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes)<br />
            Console.WriteLine("Received: {0}", responseData)<br />
<br />
            Return responseData<br />
        Catch ex As ArgumentNullException<br />
            Console.WriteLine("ArgumentNullException: {0}", ex)<br />
        Catch ex As System.Net.Sockets.SocketException<br />
            Console.WriteLine("SocketException: {0}", ex)<br />
        End Try<br />
    End Function<br />


Juste before call this method, I open the socket like this
msocket = New System.Net.Sockets.TcpClient(servername, port)

Then I send some data to it like this
Me.sendReceiveTCP("login myuser")

And the problem come now when I try to send the second data with the following code :
Me.sendReceiveTCP("pass *******")

When debugging step by step, I can notice that the problem occurs on
<br />
 Dim bytes As Int64 = stream.Read(data, 0, data.Length)<br />


The program hang and the only thing to do is to stop it.

Any1 know where I'm wrong ?

thx
Sybux
GeneralRe: TCP / Telnet client Pin
Dave Kreskowiak11-Aug-04 4:46
mveDave Kreskowiak11-Aug-04 4:46 
GeneralRe: TCP / Telnet client Pin
sybux200011-Aug-04 8:59
sybux200011-Aug-04 8:59 
Generalrow state is always set to modified Pin
kowplunk10-Aug-04 10:24
kowplunk10-Aug-04 10:24 
GeneralRe: row state is always set to modified Pin
Member 53081011-Aug-04 3:10
Member 53081011-Aug-04 3:10 
GeneralRe: row state is always set to modified Pin
kowplunk11-Aug-04 6:22
kowplunk11-Aug-04 6:22 
GeneralRe: row state is always set to modified Pin
kowplunk11-Aug-04 7:38
kowplunk11-Aug-04 7:38 
Generalusing the mouse to resize controls on a form during runtime Pin
Reddragoneye88810-Aug-04 5:57
Reddragoneye88810-Aug-04 5:57 
Generalusing data adaptors Pin
kowplunk10-Aug-04 5:53
kowplunk10-Aug-04 5:53 
GeneralRe: using data adaptors Pin
kowplunk10-Aug-04 5:58
kowplunk10-Aug-04 5:58 
GeneralRe: using data adaptors Pin
kowplunk10-Aug-04 6:21
kowplunk10-Aug-04 6:21 
General.Net Remoting - I am lost ! ! ! Pin
tommy_tanaka10-Aug-04 5:29
tommy_tanaka10-Aug-04 5:29 
GeneralRe: .Net Remoting - I am lost ! ! ! Pin
Xiangyang Liu 刘向阳10-Aug-04 6:11
Xiangyang Liu 刘向阳10-Aug-04 6:11 
GeneralRe: .Net Remoting - I am lost ! ! ! Pin
tommy_tanaka11-Aug-04 1:48
tommy_tanaka11-Aug-04 1:48 
GeneralAn application within an application... Pin
Brad Fackrell10-Aug-04 4:58
Brad Fackrell10-Aug-04 4:58 
GeneralRe: An application within an application... Pin
Dave Kreskowiak10-Aug-04 6:32
mveDave Kreskowiak10-Aug-04 6:32 
GeneralRe: An application within an application... Pin
Brad Fackrell10-Aug-04 7:20
Brad Fackrell10-Aug-04 7:20 
GeneralRe: An application within an application... Pin
Dave Kreskowiak10-Aug-04 8:18
mveDave Kreskowiak10-Aug-04 8:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.