next up previous contents
Next: getPeerName Up: Methods Previous: connect   Contents

create

Description

Creates the Windows socket and bind it to the specified address


Syntax

socket.create([port[, type[, event[, address]]]])


Parameters

port
Optional. Integer. Specifies a port to be used with the socket. The default value is 0 (Windows Sockets will select a port for the socket if the value is set to 0).
type
Optional. Integer. Specifies the socket type. Default $SOCK_STREAM.

Value Description
$SOCK_STREAM Provides sequenced, reliable, two-way, connection-based byte streams with an out-of-band data transmission mechanism. Uses TCP for the Internet address family.
$SOCK_DGRAM Supports datagrams, which are connectionless, unreliable buffers of a fixed (typically small) maximum length. Uses UDP for the Internet address family.

event
Optional. Integer. Specifies a combination of network events. Default $FD_READ | $FD_WRITE | $FD_OOB | $FD_ACCEPT | $FD_CONNECT | $FD_CLOSE

Value Description
$FD_READ Want to receive notification of readiness for reading.
$FD_WRITE Want to receive notification when data is available to be read.
$FD_OOB Want to receive notification of the arrival of out-of-band data.
$FD_ACCEPT Want to receive notification of incoming connections.
$FD_CONNECT Want to receive notification of connection results.
$FD_CLOSE Want to receive notification when a socket has been closed by a peer.

address
Optional. String. Specifies the network address (a dotted number such as กฐ219.138.64.12".) to bind.


Returns

Boolean.



next up previous contents
Next: getPeerName Up: Methods Previous: connect   Contents
Copyright ©2000-2010 Shanghai TopCMM Software Technologies. All Rights Reserved.