473,324 Members | 2,214 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,324 software developers and data experts.

Non-Blocking UDP in VB.NET for beginners?

I apologise in advance for this question has been answered at least in this
thread:

http://forums.msdn.microsoft.com/en-...d-1a567f406757

Unfortunately I'm pretty new at all this and still can't get the jist.

Basically I've implemented a UDPClient.Send and Receive, run the program and
realised what was ment by 'blocking' when i read the MSDN article. My
program hangs, waiting to receive something.

As the title says, I'm looking for a way to achieve this without blocking,
probably as answered in the thread I've linked, but in an example format, or
at least easier than even lamens terms?

I know I'm being a pain, thus the apologies.

Here is an example of the blocking udpclient procedure I'm using at the
moment: (oUDPClient is currently declared globally while I tried to figure
things out...)
--------------------------------------------
Public Function HandleIncoming() As Boolean

Dim SendersIP As String
Dim ReceivedEx As String

Try
Dim receiveBytes As [Byte]() =
oUDPClient.BeginReceive(RemoteIpEndPoint)
Dim returnData As String = Encoding.ASCII.GetString(receiveBytes)
SendersIP = RemoteIpEndPoint.Address.ToString()
ReceivedEx = returnData.ToString()
'Do stuff with ReceivedEx...
HandleIncoming = True

Catch ex As Exception
HandleIncoming = False
Exit Sub
End Try

End Function
--------------------------------------------
To add to the above, I'm using Visual Studio 2005 Standard Edition. I've
created a VB project and this networking stuff which I have no experience in,
is just a small, but unfortunately crucial part of it.

What I need the above procedure to do is trigger when an incoming
transmission is detected. The procedure can then 'select case' and react
depending on what it has received. All of which I'd like to do without the
application hanging/being blocked - so the user can go on using other
features whilst the UDPClient listens in the background.

I don't mind doing this with some sort of timer checking if there has been
something received, if there is no event that can be triggered available.
I'd prefer it if it didn't involve having to download someone's .DLL and
referencing that, but if thats the only way to do so then c'est la vie.

I've already had a look at two such methods, one provided by 'UnoLibs' and
another by the name of 'TinyServer'. Both of which do not appear to have
been written in Visual Studion 2005 and refer to lots of old/obsolete
namespaces which I've failed to update to be compliant/usable/error free, in
my VS05 SE.

Thanks in advance for any help you guys can provide.
--
-------------------------------
Please respond to my posts via the newsgroup as the e-mail provided is not
monitored.
Jul 24 '08 #1
0 1008

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

Similar topics

12
by: lothar | last post by:
re: 4.2.1 Regular Expression Syntax http://docs.python.org/lib/re-syntax.html *?, +?, ?? Adding "?" after the qualifier makes it perform the match in non-greedy or minimal fashion; as few...
5
by: klaus triendl | last post by:
hi, recently i discovered a memory leak in our code; after some investigation i could reduce it to the following problem: return objects of functions are handled as temporary objects, hence...
25
by: Yves Glodt | last post by:
Hello, if I do this: for row in sqlsth: ________pkcolumns.append(row.strip()) ________etc without a prior:
32
by: Adrian Herscu | last post by:
Hi all, In which circumstances it is appropriate to declare methods as non-virtual? Thanx, Adrian.
8
by: Bern McCarty | last post by:
Is it at all possible to leverage mixed-mode assemblies from AppDomains other than the default AppDomain? Is there any means at all of doing this? Mixed-mode is incredibly convenient, but if I...
14
by: Patrick Kowalzick | last post by:
Dear all, I have an existing piece of code with a struct with some PODs. struct A { int x; int y; };
11
by: ypjofficial | last post by:
Hello All, So far I have been reading that in case of a polymorphic class ( having at least one virtual function in it), the virtual function call get resolved at run time and during that the...
2
by: Ian825 | last post by:
I need help writing a function for a program that is based upon the various operations of a matrix and I keep getting a "non-aggregate type" error. My guess is that I need to dereference my...
0
by: amitvps | last post by:
Secure Socket Layer is very important and useful for any web application but it brings some problems too with itself. Handling navigation between secure and non-secure pages is one of the cumbersome...
399
by: =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= | last post by:
PEP 1 specifies that PEP authors need to collect feedback from the community. As the author of PEP 3131, I'd like to encourage comments to the PEP included below, either here (comp.lang.python), or...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.