ccubed
November 11th, 2008, 02:24 PM
Imports System.Net.Sockets
Public Class Form1
Dim socket As New System.Net.Sockets.TcpClient
Dim send As Byte()
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
socket.Connect("66.226.73.112", 7705)
send = System.Text.Encoding.ASCII.GetBytes("\R\N")
socket.Client.Send(send)
Recv.Text += socket.Client.Receive(send).ToString & vbNewLine
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
send = System.Text.Encoding.ASCII.GetBytes(TxtToSend.Text & "\R\N")
socket.Client.Send(send)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Recv.Text += socket.Client.Receive(send).ToString & vbNewLine
End Sub
End Class
For some reason, it stops on the recv call and when I put a check for socket.client.available being greater than 0 it never gets anything. So the problem is that i'm not receiving any data. Is there any reason why?
Public Class Form1
Dim socket As New System.Net.Sockets.TcpClient
Dim send As Byte()
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
socket.Connect("66.226.73.112", 7705)
send = System.Text.Encoding.ASCII.GetBytes("\R\N")
socket.Client.Send(send)
Recv.Text += socket.Client.Receive(send).ToString & vbNewLine
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
send = System.Text.Encoding.ASCII.GetBytes(TxtToSend.Text & "\R\N")
socket.Client.Send(send)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Recv.Text += socket.Client.Receive(send).ToString & vbNewLine
End Sub
End Class
For some reason, it stops on the recv call and when I put a check for socket.client.available being greater than 0 it never gets anything. So the problem is that i'm not receiving any data. Is there any reason why?