首页|操作系统|软件开发|网页制作|媒体动画|数据库|ASP教程|ASP.NET教程|PHP教程|JSP教程|XML教程|建站资料|软件学院|行业资讯|平面设计|网络安全|晒IT论坛|IT人才
  位置: 晒IT >> PHP教程 >> PHP提高教程 >> 正文
 
 
PHP的Socket函数参考
PHP的Socket函数参考
 
 

Socket选项表
选项 描述
SO_BROADCAST 允许自动寻址的socket发送和接受广播包
SO_DEBUG 打开socket调试功能,只有root才有权限打开该选项
SO_DONTROUTE 不接受路由包通过网关
SO_ERROR 获取并且清除最后一次的socket错误,这个选项也许不用设置
SO_KEEPALIVE 打开保持激活状态的消息
SO_LINGER Socket_colse和socket_shutdown的中止消息发送超时,该选项使用一个数组,包括l_onoff和l_linger两个键。
SO_OOBINLINE 把数据直接插入到接受缓冲
SO_RCVBUF 限制接受缓冲的最大字节
SO_RCVLOWAT 延迟通过接受一个最小的数据
SO_RCVTIMEO 延迟报告一个接受超时报告,使用数组的两个键:sec和usec
SO_REUSEADDR 允许重新使用本地地址
SO_SNDBUF 限制发送缓冲的最大字节
SO_SNDLOWAT 延迟发送数据到这个协议当接受一个最小的字节
SO_SNDTIMEO 延迟报告超时错误,当发送发送通过一个时间。该选项使用数组的键值:sec和usec
SO_TYPE 获取socket的类型,该选项可能不用设置

boolean socket_getpeername(resource socket, string address, integer port)
socket_getpeername从指定的一个连接中获取地址和端口。如果连接为Unix socket,那么将返回文件系统的路径。
boolean socket_getsockname(resource socket, string address, integer port)
socket_getsockname放置一个名字到socket中,并且加上address和port参数。失败返回false。
(下面的socket_iovec_* 函数不太了解,不敢乱翻译,保留原文)
boolean socket_iovec_add(resource iovector, integer length)
The socket_iovec_add unction adds an I/O vector to the scatter/gather array.
resource socket_iovec_alloc(integer count, …)
The socket_iovec_alloc function returns a resource for handling a collection of I/O vectors. The first argument specifies the number of vectors. Following arguments specify the length of each vector.
boolean socket_iovec_delete(resource iovector, integer position)
The socket_iovec_delete function removes the I/O vector at the given position.
string socket_iovec_fetch(resource iovector, integer position)
The socket_iovec_fetch function returns the value of the specified vector in the I/O vector resource.
boolean socket_iovec_free(resource iovector)
The socket_iovec_free function frees the memory used for an I/O vector resource.
boolean socket_iovec_set(resource iovector, integer position, string value)
The socket_iovec_set sets the value of I/O vector at the given position.
integer socket_last_error(resource socket)
socket_last_error函数返回操作中的任何socket函数产生的最后错误。你也许在上面函数中设置了socket资源的socket选项在指定的连接上。下面的表列出了返回的错误代码,你同样可以使用soclet_strerror函数来获取详细的错误。使用socket_clear_error函数清除socket的错误。
  • 上一篇: header()函数使用说明
  • 下一篇: PHP和Socket
  •  告诉好友  打印此文 关闭窗口 返回顶部
     
    热点文章
     
     
    推荐文章
     
     
    相关文章

    | 设为首页 | 加入收藏 | 联系我们 | 友情链接 | 诚聘英才 |
    Copyright© 2008 ShaiIT.Com .All Rights Reserved
    下载alexa工具,提升您的网站排名