MC-Basic:ACCEPT/zh-hans

From SoftMC-Wiki
< MC-Basic:ACCEPT
Revision as of 02:35, 17 April 2017 by Chi (talk | contribs)
Jump to: navigation, search
语言: [[::MC-Basic:ACCEPT|English]]  • [[::MC-Basic:ACCEPT/zh-hans|中文(简体)‎]]


|缩写=


|格式= Accept({#<listening device number>}, #<accepting device number>, <port number>)

|使用版本=


|描述= 将TCP 套接字 绑定到特定端口并接受该端口连接,监听TCP 套接字. <port number>定义TCP端口。

|类型= <listening device number>: Long

<accepting device number>: Long

<port number>: Long


|范围= <listening device number>:  1 to 255

<accepting device number>:  1 to 255

<port number>:  6000 through 6999

|单位=


|默认=


|使用范围= Task

|限制= Task only

错误:

  • 套接字不可用
  • 无法连接

|例子= 例子

Accept(#1,65456)

例子 - 从版本4.0.14起:

Dim X as long = 2

OpenSocket Options=1 as #1 ‘明确打开套接字的监听端口

while TRUE

OpenSocket Options=1 as #X ‘明确打开套接字接受新的连接的监听端口

Accept(#1, #X, 6002)

X=X+1

End while

在种情况下:

  • 监听设备是固定的,并且已经绑定到端口上。只有当监听结束时才能被关闭。
  • 接受设备[x]每次创建一个侦听器创建新的服务任务。
  • 接收设备[x]在接收数据时不能关闭应用程序。

|参见=