需要什么绑定客户端的情况下()? [英] What client-side situations need bind()?

查看:99
本文介绍了需要什么绑定客户端的情况下()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我学习C套接字编程。你什么时候会在客户端使用bind()?什么类型的节目都需要它,为什么?我在哪里可以找到一个例子吗?

I'm learning C socket programming. When would you use bind() on the client-side? What types of program will need it and why? Where can I find an example?

推荐答案

在客户端,你只会如果要使用特定的客户端的端口,这是罕见的使用绑定。通常在客户端上,您指定的服务器计算机的IP地址和端口,操作系统将接你将使用哪个端口。一般来说,你不关心,但在某些情况下,可能有客户端,只允许特定端口上的传出连接上的防火墙。在这种情况下,你将需要绑定到特定端口之前,连接尝试将工作。

On the client side, you would only use bind if you want to use a specific client-side port, which is rare. Usually on the client, you specify the IP address and port of the server machine, and the OS will pick which port you will use. Generally you don't care, but in some cases, there may be a firewall on the client that only allows outgoing connections on certain port. In that case, you will need to bind to a specific port before the connection attempt will work.

这篇关于需要什么绑定客户端的情况下()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆