简体   繁体   English

套接字 C 客户端特定编号

[英]socket C client specific number

I have a server code in C that accepts 5 clients.我有一个接受 5 个客户端的 C 语言服务器代码。 Also, have a separate file client.c However, If I want for each client a specific integer number(enter by user) that not allow him to connect to the server again how can i do that Is there a specific data structure or way to send that number to the server.另外,有一个单独的文件 client.c 但是,如果我想为每个客户端提供一个特定的整数(由用户输入),不允许他再次连接到服务器,我该怎么做,是否有特定的数据结构或方法将该号码发送到服务器。

Server and Client programs should work on same and different machines.服务器和客户端程序应该在相同和不同的机器上运行。 Thank you!谢谢!

Please make your question clear.请把你的问题说清楚。

Are all your clients running on the same machine?您的所有客户端都在同一台机器上运行吗?

If all clients are running on different machines then probably you can keep a track of their IP addresses and then you can allow each client to connect once.如果所有客户端都在不同的机器上运行,那么您可能可以跟踪它们的 IP 地址,然后您可以允许每个客户端连接一次。

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

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