ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I want to send ten integers from 0-9 from a server to a client.
Both sides have a tcp and udp sockets.
The even numbers, 0 included, will be sent thru the tcp.
The odd numbers will be sent thru the udp.
This is what I wrote but it gives me a bad address error by the recvfrom on the client side.
Any idea how to solve this problem ?
I know that a tcp and udp can be on the same port, since Ip header makes it clear what protocol is being used.
But I am running the client and server on the same pc. Maybe thats the problem that we have two udp and two tcp on the same port. Can that be it ? If so how do I solve this ?
I understand you require help with your application, however posting your query on multiple forums (the other being the Ubuntu Programming Forum) just adds clutter to the WWW.
Anyhow, should anyone else come across this thread, click on this link to see my response to FaresH's question.
Anyhow I solved my problem a few minutes ago, I just came to say that I solved it.
The error was not in the design, it was in the recvfrom.
recvfrom requires that the last parameter must be a pointer. Unlike in sendto. I am assuming because recvfrom updates/changes something in the struct sockaddr_in client. Maybe the size changes.
And I was giving it sizeof(client). So it couldn't update it.
So the second time recvfrom was called, it gave me a bad address.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.