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

Can we have same port for two UDP applications

Hi

I am writing a simple client server program in c# using sockets over UDP. Can I use same port for both the client and server to send and receive data (like in TCP) . I am trying to do the following but its not working.

sockListener = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);

sockListener.Bind(ipEHost); // port 4050

when i do it on both server and client, an exception is thrown that only one app can open a port. but when i specify a different port on client or server (eg 4051) then it works fine.(client sends on 4051 and listens on 4050 and server does the otheway) What am i doing wrong to make both of them communicate over the same port.

Besides what calls do I need to make for sending and receiving Now I am using SendTo and Receive and it works fine when i specify different ports.

After initializing socket shall i use bind call for the server and the connect call for client? Whats the difference between connecting to local or remote endpoint with respect to UDP

Usman
Apr 12 '07 #1
0 1150

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Lizard King | last post by:
Hi. I have a computer running a third party software (POS). The thing is this application opens the printer port and I need to use another program while the first one is still running. Since...
1
by: B or T | last post by:
How do you dynamically allocate a port number (assured that it is not already in use), and advertise it (by name or ID)? Every book I come across seems to hard code/configure a specific port...
3
by: Sagaert Johan | last post by:
Is there a c# solution for this ? It may work like the MSCOMM control. Applications that use the MSCOMM ocx should distribute this component too, so i want to avoid this. How can serial port...
3
by: Ramakant Kasar | last post by:
Hi, If an application is reading data from a serial port, How can I open the same serial port with another application? Any idea? Please help. Thanks, Ramakant K.
3
by: ZhangZQ | last post by:
I want to monitor the data send and receive in the comm port, is it possible to do this? Thank you very much!
1
by: Stuart | last post by:
I am writing software to mimic the actions of a device connected to the serial port. I want my software to create a virtual COM port, so that other applications can talk to it. Is it possible...
2
by: Alan P. Summerlin | last post by:
Hello All, I am about to start a new job and one of my first tasks will be to port an old VB (for DOS) application to VB.net. I have quite a bit of experience with VB 6.0 and no experience with...
6
by: Peter | last post by:
I'm interested to know what ideas are out there for reading a parallel port at a constant sample rate while still allowing the user to interact with the GUI. That is, reading it every 10ms for...
4
by: max_mont | last post by:
Hi all, I'm a newbie in .NET technology. I've already developed Serial communication applications in C++ (WIN32). And I wanted to migrate to .NET technology. There is a serial component in...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.