简体   繁体   English

Unix网络编程

[英]unix network programming

I want to send the two different packets in different port numbers parallely using UDP. 我想使用UDP在不同的端口号中并行发送两个不同的数据包。 Can I achive this using single socket() or should I create another socket?? 我可以使用单个socket()实现此功能还是应该创建另一个套接字? Can anbody give me some idea on this. 有人可以给我一些想法吗?

Thanks in advance 提前致谢

You can use a single socket, you will be using the system calls sendto(2) and recvfrom(2) to send and receive data over the datagram sockets. 您可以使用单个套接字,将使用系统调用sendto(2)recvfrom(2)通过数据报套接字发送和接收数据。

Take a look at https://beej.us/guide/bgnet/html/multi/syscalls.html for more information (the entire guide is definitely worth the read). 请查看https://beej.us/guide/bgnet/html/multi/syscalls.html了解更多信息(整个指南绝对值得阅读)。

Beej's guide on socket programming Beej套接字编程指南

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM