Constructor

new()

Methods

Inherited Variables

Defined by Socket

@:keepcustom:Dynamic

Available on cpp, php, macro, jvm, hl, neko, python

A custom value that can be associated with the socket. Can be used to retrieve your custom infos after a select.

@:keepread onlyinput:Input

The stream on which you can read available data. By default the stream is blocking until the requested data is available, use setBlocking(false) or setTimeout to prevent infinite waiting.

@:keepread onlyoutput:Output

The stream on which you can send data. Please note that in case the output buffer you will block while writing the data, use setBlocking(false) or setTimeout to prevent that.

Inherited Methods

Defined by Socket

@:keepaccept():Socket

Accept a new connected client. This will return a connected socket on which you can read/write some data.

@:has_untyped@:keepclose():Void

Closes the socket : make sure to properly close all your sockets or you will crash when you run out of file descriptors.

@:has_untyped@:keephost():{port:Int, host:Host}

Return the information about our side of a connected socket.

@:keeplisten(connections:Int):Void

Allow the socket to listen for incoming questions. The parameter tells how many pending connections we can have until they get refused. Use accept() to accept incoming connections.

@:has_untyped@:keeppeer():{port:Int, host:Host}

Return the information about the other side of a connected socket.

@:keepread():String

Read the whole data available on the socket.

Note: this is not meant to be used together with setBlocking(false), as it will always throw haxe.io.Error.Blocked. input methods should be used directly instead.

@:keepshutdown(read:Bool, write:Bool):Void

Shutdown the socket, either for reading or writing.

@:keepwaitForRead():Void

Block until some data is available for read on the socket.

@:keepwrite(content:String):Void

Write the whole data to the socket output.

Note: this is not meant to be used together with setBlocking(false), as haxe.io.Error.Blocked may be thrown mid-write with no indication of how many bytes have been written. output.writeBytes() should be used instead as it returns this information.