473,395 Members | 1,537 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Curious UDP issue.

I have a class that listens to and sends UDP packets. For some reason,
if I listen to and send out packets via the same UdpClient object,
everything works fine. If I send out a packet on a different UdpClient
object, the data never gets there. The code is below. Can someone clue
me into the problem? Thanks.

imports System.Text.Encoding

dim oServer as New UdpClient(6501)
dim oClient as New UdpClient

Dim RemoteIpEndPoint As New IPEndPoint(IPAddress.Any, 0)
Dim sendBytes As Byte()
Dim As String
Dim sMessageOut As String = "test"

Do
'receive the data
sMessageIn = ASCII.GetString(oServer.Receive(RemoteIpEndPoint))

sIpAddress = RemoteIpEndPoint.Address.ToString
iPort = RemoteIpEndPoint.Port

'*****THIS DOES NOT WORK********
oClient.Connect(sIpAddress, iPort)
sendBytes = ASCII.GetBytes(sMessageOut)
oClient.Send(sendBytes, sendBytes.Length)
'*********THIS WORKS*********
oServer.Connect(sIpAddress, iPort)
sendBytes = ASCII.GetBytes(sMessageOut)
oServer.Send(sendBytes, sendBytes.Length)

Loop
Nov 16 '05 #1
0 859

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul Mateer | last post by:
Hi, I have been running some queries against a table in a my database and have noted an odd (at least it seems odd to me) performance issue. The table has approximately 5 million rows and...
1
by: Tony Do | last post by:
Does anyone have problem of running stored procedure from VB .NET using the ODBC driver, The OleDB driver work OK with the same Stored Procedure, also the ASP work OK with that same Stored...
40
by: Confused User | last post by:
I am curious what the origins of size_t are. I see that it is usually typedef'd to be the native integer size of a particular machine. I also see that routines like strncpy(char *t, const char *s,...
7
by: tshad | last post by:
I was curious if there is some reason why you don't need the "then" in the if test of VB.Net or is it just ASP.NET. I just noticed that I don't really need to explicitly put the word "then" as...
6
by: Dave | last post by:
I was curious in regards to Access 12; specifically more fluent report formatting. I'm an average user, but from my end, I find more and more need for cleaner reports....and do not always want...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.