473,382 Members | 1,635 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,382 software developers and data experts.

Simultaneous reveiving of UDP/TCP Messages

I want to write a server such that it receives UDP and TCP messages on same port continuously.

I have created 2 sockets tcpsock, udpsock. I am binding them to same port by using (setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one)) < 0) function.

Now if i want to receive messages on both of these sockets..

while(1) {
newsock = accept(tcpsock, (struct sockaddr*)&sin, &sinlen);
recv(newsock, buffer, MAXBUFF-1, 0))== -1);

recvfrom(udpsock, buffer, MAXBUFF-1, 0, (struct sockaddr*)&sin, &sinlen))== -1);
}

is this possible? if possible, how these sockets differentiate messages like udp messages and tcp messages? will there be any conflict? or is there any other possibility to do this?


Thanks,
Kiran
Apr 18 '07 #1
1 1574
I do not think it is possible!!

There are some libraries (libpcap) by which you can capture all of packets coming to your network interface then you may use some filters to capture packets on specific port.

maybe there is easier way to do that... wait for further posts.
Apr 18 '07 #2

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

Similar topics

19
by: Claudio Grondi | last post by:
I would like to save time copying the same file (>6 GByte) to various different target storage media connected to the system via USB. Is there a (Python or other) tool able to help me to do...
1
by: slugger | last post by:
Hope this is not OT: I am running into some strange things whenever my ASP pages send out simultaneous requests to another ASP page which in turn gains access to a MySQL database using a DSNless...
6
by: Jimnbigd | last post by:
I want to write a game, and sounds will really add to it. Note that I would always make the sounds optional. I hate it when I go to a URL and unexpectedly get sounds or music. I have played...
1
by: Semaj | last post by:
Environment: DB2 8.1.4; Windows 2000 We are evaluating the feasibility of upgrading our production DB from 7.2 to 8.1. During this process we've encountered an error when starting our...
5
by: Dexter | last post by:
Hello all, I need all my developers work at a project simultaneous. How it is possible? I need a machine as web server? And how to configure the visual studio to all to work simultaneous? ...
12
by: Dan V. | last post by:
Since an ASP.NET/ADO.NET website is run on the server by a single "asp_net worker process", therefore doesn't that mean that even 50 simultaneous human users of the website would appear to the...
8
by: Richard Aubin | last post by:
I'm creating an application that needs to go through over 2,000 loops repeatedly. However, the user interface is "locking up" while the processing is happening. Why is this happening, and how...
1
by: Simon | last post by:
Is there HTTP connection limit of 2 simultaneous connections in webservices? For example what hapens if you use webservices form ASP.NET web application? Presumably ASP.NET is webservices client to...
4
by: raylopez99 | last post by:
Compound question: first, and this is not easy, if there's a way to detect multiple simultaneous key presses in C# let me know (in the below code, keys c and d being pressed simultaneously or...
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
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
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...

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.