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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Winsock between eVB and VB.NET

Status
Not open for further replies.

BrianB

Programmer
Oct 2, 2000
186
US
My winsock troubles:

Hi all,

I have a Embeedded VB app running on a Win CE device that needs to send data to a VB.NET service running on Win2K. The Embedded VB uses the standard Winsock control and the sendata command to send a string to the VB.NET application. Trouble is, I seem to be getting an empty network stream on the VB.NET box.

Any suggestions are appreciated.

-Brian


On the handheld:

Outbound connection is a winsock activeX control. It uses TCP and port 10101.

frmMain.OutboundConnection.Connect
frmMain.OutboundConnection.SendData ("Hello World!")
frmMain.OutboundConnection.Close


On the VB.net machine
dim m_Listener as TCP Listener
Dim client As TcpClient
Dim nstm As NetworkStream
Dim intJ As Int32
dim blnNeedPrint as boolean

client = m_Listener.AcceptTcpClient
client.ReceiveBufferSize = 1024
Do

Dim arrByte(client.ReceiveBufferSize) As Byte
nstm = client.GetStream
If nstm.DataAvailable = True Then

If nstm.CanRead Then
nstm.Read(arrByte, 0, CInt(client.ReceiveBufferSize))
End If

'this bit checks to see if we actually have any data. There never is any
For intJ = 0 To UBound(arrByte)
If arrByte(intJ) <> 0 Then
blnNeedPrint = True
End If
Next

If blnNeedPrint = True Then
Me.TextBox1.Text = System.Text.Encoding.ASCII.GetString(arrByte)
End If
End If
Me.Refresh()
Loop
m_Listener.Stop()
m_Listener = Nothing

End Sub
 
I dont see where you are assigning a port number on your NET side. Try:

Private m_Listener As TcpListener

m_Listener = New TcpListener(10101)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top