Difference between revisions of "MC-Basic:ACCEPT"

From SoftMC-Wiki
Jump to: navigation, search
(Created page with '{{MC-Basic |SHORT FORM= |SYNTAX= Accept( ''{#<ListeningDevice number>}'' , #<''Accepting device number''>, <''port number''>) |AVAILABILITY= |DESCRIPTION= Binds a TCP socket…')
 
m (1 revision)
(No difference)

Revision as of 16:09, 13 December 2010

Binds a TCP socket to specific port and accepts a connection. Listens to a TCP socket. The <port number> defines TCP port

Syntax

Accept( {#<ListeningDevice number>} , #<Accepting device number>, <port number>)

Type

<Listeningdevice number> : Long

<Acceptingdevice number> : Long

<port number> : Long

Range

< Listening device number> :  1 to 255

< Accepting device number> :  1 to 255

<port number> :  6000 through 6999

Scope

Task

Limitations

Task only

Errors                  Invalid socket

Cannot accept connection

Examples

Accept(#1,65456)

Or  for Versions 4.0.14 and higher :

Dim X as long = 2

OpenSocket Options=1 as #1 ‘explicit socket open for listening for port

while TRUE

OpenSocket Options=1 as #X ‘ explicit socket open for listening accepting a

‘ new  connection

Accept(#1, #X, 6002)

X=X+1

End while

Where the rules are

1.      ListeningDevice is permanent and bound to the port it can be closed only when listener terminated

2.      AcceptingDevice[x] is created every time when listener creates new server task

3.      Application shall not close     AcceptingDevice[x] when it is in accept

See Also