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.
pc 1 sends message to pc 3 through pc 2, and pc 2 will run a usespace program to listen the packet(message) passed through it.
I wanna ask how I can send the packet back to pc 1 in the same userspace program since this packet should be forward to pc 3 (instead of backward) and connection can not be made.
how about I run another program in the userspace program?
I have tried if the progam is for connection, I can't run it from a program already running.?
I dont know what exactly you mean, but I think that you are trying to send the packets from pc 1 to pc 3 and from pc3 to the pc 1 in the same time. Whether it's that, you should use asynchronical mode of those sockets (set it in application on pc2). Its quite easy, you have to use fnctl function, defined in fcntl.h header:
fnctl(int socket, F_SETFL, O_NONBLOCK);
..for both sockets.
I dont know whether it's exactly what you mean, but this feature will allow your application to send packets from pc 1 to pc 3 and pc 3 to pc 1.
becky you have posted variations of this same damn question over and over. nobody really understands exactly what you're talking about; i've already tried to help you multiple times. what do u expect? someone to write the shit for u?
infamous: chill dude - there's no need to get uppity about multiple postings... I agree it's annoying but lets face it, it's not gonna hurt anyone (I haven't seen 1 person so far that would get grumpy if you did it)...
Becky, i agree with infamous - if you would like some help then please post your code and then we can see what you already have
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.