Description
 Top Next
Socket Object Plugin for AutoPlay Media Studio

With the help of this object plugin, you can build full featured network enabled applications with AutoPlay Media Studio. With a few lines of Lua script and by dropping a single socket object on the page, you may build server or client projects, communicate with remote servers, exchange messages, send mail, chat, etc. You will find a few examples of applications at the end of this documentation.

Version History

1.0.4.0 - Changed parameters:
· Socket.FindServer()
· Socket.GetHostByAddress()
· Socket.GetHostByName()
New action:
· Socket.Ping()

1.0.3.5 - New socket family:
Included experimental support for UDP sockets

1.0.2.0 - New actions:
· Socket.SetMaxClients()
· Socket.SetPort()

1.0.1.0 - Initial release, May 2009

Additional Information
Socket Plugin on the web Homepage of this plugin
Contact the developer Contact form

Plugin is copyright © 2009 MindQuake Serviços de Informática Ltda.

AutoPlay Media Studio and the Indigo Rose logo are trademarks of Indigo Rose Software Design Corporation. All other trademarks and registered trademarks mentioned in this document are the property of their respective owners.


Properties
 Previous Top Next
Properties

This screen will allow you set certain characteristics of the socket.

Protocol

This drop-down allows you to select the protocol of the socket. The options are TCP (default), or UDP. Please note that UDP is a connectionless protocol and therefore unreliable, and for this reason much more limited than TCP, which allows full-duplex data transmissions. Several functions will be available for TCP sockets only, like the possibility to listen for incoming connections.

This option is disabled during the evaluation period. It will be enabled once a valid activation code is provided.

Listen

If this checkbox is set, the socket will function as a server socket and will accept incoming connections after Socket.StartServer() is executed. If it remains unchecked, this socket will function as a client socket, and may connect to remote sockets with Socket.Open() .

Port Number

If the socket is set to function as a server (by setting the Listen option above), this field will be used to set the port number the server socket will listen on. It may be any positive value, but it is recommended to use port numbers above 1024 as lower numbers are reserved for well-known network services and the use of such ports may cause problems. For example, web servers listen on port 80.

Max clients

You may set here the maximum number of clients that may connect simultaneously to the server socket. This may be required if your application is a game that supports just fours players, for example. A fifth connection would not make sense, so it will be rejected as long as there are four players online.

Announce

If checked, the server socket will be announced on a public central server, so client applications may find the server by its nickname without needing to know the IP address. This is interesting if the server is running on a dynamic IP address, for example.

Nickname

Set here the public name of your server socket. This may be any string, like "MyPrivateChat". The nickname will stay announced on the central server for 6 hours. For further information, see Socket.PublishServer() .

Activation

If the plugin is still working in evaluation mode (you did not unlock it with a proper code), this button will display the Activation dialog . You need this info if you want to unlock the plugin.


On Accept
On Accept

This event fires when the server socket receives a new client connection. For this to happen, Socket.StartServer() has to be called first.


On Read
On Read

This event is fired when there is new data to be read from the input queue. For this event to happen, Socket.StartServer() or Socket.StartClient() must be called previously. To check the size of the incoming data, use Socket.GetInputQueueSize() , and to fetch the data, use Socket.GetInputQueue() .

The event variable e_Sock will tell you the handle (the numeric identification) of the socket that received new data, so you can read the message directly with Socket.GetInputQueue() from it.


On Close
On Close

This event is fired when the socket was disconnected. For this event to happen, Socket.StartServer() or Socket.StartClient() must be called previously.


Socket.Close()
Socket.Close(string ObjectName);

Description:

Closes an open socket. If the socket was set up to create events, you should use Socket.StopClient() instead.

ObjectName:

(string) The name of the Socket object.

Returns:

(boolean) True if the action succeeded, false if there was some kind of error. You can use Application.GetLastError() to determine whether this action failed, and why.

Example:
-- close the active socket
res = Socket.Close("mySocket");


Socket.FindServer()
Socket.FindServer(string Nickname);

Description:

Retrieves the IP address and port number of a public remote server socket.

Nickname:

(string) The public name of the server socket to be located.

Returns:

(table) The ip address and port number of the remote socket if found, or nil if the server is not online (or announcement expired). You can use Application.GetLastError() to determine whether this action failed, and why.

Example:
-- find the public chat server
sock = Socket.FindServer("MyChatRoom");
if (sock ~= nil) then
    SrvAddress = sock["address"];
    SrvPort = sock["port"];
    -- connect to the server
    ok = Socket.Open("MyClientSocket", SrvAddress, SrvPort);
    if ok then
        Dialog.Message("Info", "You are now connected to the chat server", MB_OK);
    else
        Dialog.Message("Info", "Unable to connect to chat server", MB_OK);
    end
else
    Dialog.Message("Info", "Server could not be found, may be offline", MB_OK);
end


Socket.GetHostByAddress()
Socket.GetHostByAddress(string Ipaddress);

Description:

Retrieves the host name of an ip address. This is useful for protocols that require that you inform the reverse DNS for an ip address at some point of the comunication.

Ipaddress:

(string) The ip address to perform a reverse DNS lookup on.

Returns:

(string) The common name of the address for the ip address. You can use Application.GetLastError() to determine whether this action failed, and why.

Example:
-- do a reverse dns lookup
revname = Socket.GetHostByAddress("174.19.143.186");
test = Application.GetLastError();
if (test == 0) then
    Dialog.Message("Info", "The reverse name is " .. revname, MB_OK);
else
    Dialog.Message("Error", "Could not resolve reverse DNS, error " .. test, MB_OK);
end


Socket.GetHostByName()
Socket.GetHostByName(string Name);

Description:

Retrieves the ip address of known server name. You need to provide the ip address to the Socket.Open() function, so if you know only the common name, use this function first to get the current address.

Name:

(string) The name of the address, as known in the DNS.

Returns:

(string) The ip address that corresponds to the network address. You can use Application.GetLastError() to determine whether this action failed, and why.

Example:
-- find the ip address of my mail server
address = Socket.GetHostByName("pop.sao.terra.com.br");
test = Application.GetLastError();
if (test == 0) then
    Dialog.Message("Info", "The ip address name is " .. address, MB_OK);
else
    Dialog.Message("Error", "Could not resolve this name, error " .. test, MB_OK);
end


Socket.GetInputQueue()
Socket.GetInputQueue(string ObjectName, number Handle);

Description:

Retrieves the bytes received and pending read from the socket.

ObjectName:

(string) The name of the Socket object.

Handle:

(number) The identifier of the socket that should be queried. This number probably should be the variable e_Sock from the On Read event.

Returns:

(string) The buffer with unread data that was received by the socket. You can use Application.GetLastError() to determine whether this action failed, and why.

Example:
-- echo the received data to every connected client socket
clients = Socket.ListClients("myServerSocket");
buffer = Socket.GetInputQueue("myServerSocket", e_Sock);
for i = 1, Table.Count(clients) do
    Socket.SetOutputQueue("myServerSocket", clients[i], buffer);
end


Socket.GetInputQueueSize()
Socket.GetInputQueueSize(string ObjectName, number Handle);

Description:

Retrieves the number of bytes received and pending read from the socket.

ObjectName:

(string) The name of the Socket object.

Handle:

(number) The identifier of the socket that should be queried. This number probably should be the variable e_Sock from the On Read event.

Returns:

(number) The number of bytes (chars) of unread data that was received by the socket. You can use Application.GetLastError to determine whether this action failed, and why.

Example:
-- received some data from connected client
bytes = Socket.GetInputQueueSize("myServerSocket", e_Sock);
Dialog.Message("info", "Data received from " .. e_Sock .. ", " .. bytes .. " bytes available.", MB_OK);


Socket.Kick()
Socket.Kick(string ObjectName, number Handle);

Description:

Disconnects a client socket (kicks a connected user).

ObjectName:

(string) The name of the Socket object.

Handle:

(number) The identifier of the socket that should be closed.

Returns:

(boolean) True if the socket was disconnected, or false otherwise. You can use Application.GetLastError() to determine whether this action failed, and why.

Example:
-- disconnect an annoying user
success = Socket.Kick("myServerSocket", connectedUser[3]);


Socket.ListAddresses()
Socket.ListAddresses(string ObjectName);

Description:

Returns the remote addresses of all connected clients to the server socket.

ObjectName:

(string) The name of the Socket object.

Returns:

(table) A list of ip addresses of the currently connected client sockets, or nil if there is no client connected. You can use Application.GetLastError() to determine whether this action failed, and why.

Example:
-- get the currently connected clients
list = Socket.ListAddresses("myServerSocket");
for i = 1, Table.Count(list) do
    Dialog.Message("info", "connected client " .. i .. ": " .. list[i], MB_OK);
end


Socket.ListClients()
Socket.ListClients(string ObjectName);

Description:

Returns a list of the connected clients (numeric identifiers, handles) to the server socket.

ObjectName:

(string) The name of the Socket object.

Returns:

(table) A list of handles of the currently connected client sockets, or nil if there is no client connected. You can use Application.GetLastError() to determine whether this action failed, and why.

Example:
-- get the currently connected clients
list = Socket.ListClients("myServerSocket");
for i = 1, Table.Count(list) do
    Dialog.Message("info", "handle " .. i .. ": " .. list[i], MB_OK);
end


Socket.Open()
Socket.Open(string ObjectName, string Address, number Port);

Description:

Establishes a connection to a server socket, using the remote IP address and the port number to connect to. If you want to be able to get events from this socket, you need to call Socket.StartClient() before you execute Socket.Open(). This is not required if you want to use Socket.Send() and Socket.Read() directly on the socket.

ObjectName:

(string) The name of the Socket object.

Address:

(string) The ip address to connect to. This might be the result from a call to Socket.FindServer() , or a static ip address.

Port:

(number) The port number of the remote server. Again, this info may be part of the response of a former call to Socket.FindServer() , or it may be a static number, if you want to connect to a well known service (FTP, POP3, SMTP, telnet, etc.).

Returns:

(boolean) True if the connection succeeded, or false if it failed. You can use Application.GetLastError() to determine whether this action failed, and why.

Example:
-- try to connect to the mail server on the local network
connected = Socket.Open("mySocket", "192.168.0.34", 110);
if connected then
    Dialog.Message("Info", "Now connected to POP3 server", MB_OK);
else
    Dialog.Message("Error", "Could not connect to server", MB_OK);
end


Socket.Ping()
Socket.Ping(string Address);

Description:

Sends a raw ICMP message to a remote ip address in order to detect if the remote address can be reached. Every network adapter normally answers to ICMP echo requests, even if there is no server application (like HTTP, FTP) running. Please note that ICMP packets can get blocked by firewalls, so even if the remote address is reachable, you may get no answer to a ping request.

Address:

(string) The ip address to test. This might be the result from a call to Socket.FindServer() , a result from Socket.GetHostByName() or a known ip address.

Returns:

(number) The number of milliseconds necessary to get an answer from the remote address, or -1 in case of an error. You can use Application.GetLastError() to determine whether this action failed, and why.

Example:
-- check remote computer on the local network
delay = Socket.Ping("192.168.0.10");
error = Application.GetLastError();
if (error ~= 0) then
    Dialog.Message("Error", "Received error " .. error, MB_OK|MB_ICONEXCLAMATION);
else
    Dialog.Message("Info", "Got answer in " .. delay .. " milliseconds", MB_OK);
end


Socket.PublishServer()
Socket.PublishServer(string ObjectName);

Description:

Refreshes the announcement of a public server socket. The announcement made with Socket.StartServer() expires automatically after 6 hours, and you may use this function to re-announce your server, if it stays online for longer periods.

ObjectName:

(string) The name of the Socket object.

Returns:

(boolean) True if the action succeeded, or false if it failed. You can use Application.GetLastError() to determine whether this action failed, and why.

Example:
On Show event:
-- fire up the socket and start a timer
online = Socket.StartServer("myServerSocket");
Page.StartTimer(21600000); -- 6 hours = 21600 seconds * 1000 miliseconds

On Timer event:
-- re-announce the server so remote clients will still be able
-- to find me after more than 6 hours online
refresh = Socket.PublishServer("myServerSocket");


Socket.Read()
Socket.Read(string ObjectName, number Timeout);

Description:

Retrieves a message received by the socket. If there is nothing to be retrieved, this function will wait (blocking the execution) until something was received, or the timeout is reached. If you need to be able to receive messages from the remote computer at any time without waiting for it, you should use events instead. You set the socket into event-driven mode with Socket.StartClient() before you execute the Socket.Open() .

ObjectName:

(string) The name of the Socket object.

Timeout:

(number) The maximum interval to wait for data, in seconds. This value is optional, and the default timeout for socket operations is 20 seconds.

Returns:

(string) The data received by the socket. You can use Application.GetLastError() to determine whether this action failed, and why.

Example:
-- read data received on the connected socket
message = Socket.Read("mySocket", 10);
if String.Length(message) > 0 then
    Dialog.Message("Info", "Received some data", MB_OK);
else
    Dialog.Message("Error", "No data available", MB_OK);
end


Socket.Send()
Socket.Send(string ObjectName, string Message, number Timeout);

Description:

Sends a string message to a remote socket.

ObjectName:

(string) The name of the Socket object.

Message:

(string) The text to be transmitted to the remote socket.

Timeout:

(number) The maximum interval to attempt to send the data. A socket may be busy, not accepting new data immediately, so there could be a delay before you are able to send new data. This value is optional, and the default timeout for socket operations is 20 seconds.

Returns:

(number) The number of chars successfully sent. Upon a normal circumstances, this value should correspond to the length of the string. You can use Application.GetLastError() to determine whether this action failed, and why.

Example:
-- send a message through the socket
message = "This is a test.";
numChars = Socket.Send("myClientSocket", message);
if numChars == String.Length(message) then
    Dialog.Message("Info", "Message sent successfully.", MB_OK);
else
    Dialog.Message("Error", "Something went wrong!", MB_OK);
end


Socket.SetMaxClients()
Socket.SetMaxClients(string ObjectName, number Clients);

Description:

Sets the maximum number of clients that may connect to the server socket. This value should be a value between 1 and 128. You cannot alter the maximum number of allowed clients once the server socket was started with Socket.StartServer() .

ObjectName:

(string) The name of the Socket object.

Clients:

(number) The number of clients that the server can handle.

Returns:

(boolean) Returns true if the action succeeded, or false if it failed. You can use Application.GetLastError() to determine whether this action failed, and why.

Example:
-- adjust the number of clients that are allowed to connect
res = Socket.SetMaxClients("myServerSocket", 10);
error = Application.GetLastError();
if (error == 0) then
    Dialog.Message("Info", "Server set to 10 clients!", MB_OK);
else
    Dialog.Message("Error", "Server already running? Got error " .. error, MB_OK);
end


Socket.SetOutputQueue()
Socket.SetOutputQueue(string ObjectName, number Handle, string Message, number Timeout);

Description:

Sends a string message to a remote socket. This function is similar to Socket.Send() , however this one is to be used on connected clients. The ObjectName has to be the identifier of a socket in the listening state, while the Handle is one of the identifiers returned by Socket.ListClients() .

ObjectName:

(string) The name of the Socket object.

Handle:

(number) A identifier of a connected client socket.

Message:

(string) The text to be transmitted to the remote socket.

Timeout:

(number) The maximum interval to attempt to send the data. A socket may be busy, not accepting new data immediately, so there could be a delay before you are able to send new data. This value is optional, and the default timeout for socket operations is 20 seconds.

Returns:

(number) The number of chars successfully sent. Upon a normal circumstances, this value should correspond to the length of the string. You can use Application.GetLastError() to determine whether this action failed, and why.

Example:
-- send a message through the socket
message = "This is a test.";
numChars = Socket.SetOutputQueue("myServerSocket", client[2], message, 5);
if numChars == String.Length(message) then
    Dialog.Message("Info", "Message sent successfully.", MB_OK);
else
    Dialog.Message("Error", "Something went wrong!", MB_OK);
end


Socket.SetPort()
Socket.SetPort(string ObjectName, number Port);

Description:

Sets the port number the server socket should listen on. This value should be a value between 20 and 65535. You cannot change the port number if the server socket is listening for connections.

ObjectName:

(string) The name of the Socket object.

Port:

(number) The port number to listen for incoming connections.

Returns:

(boolean) Returns true if the action succeeded, or false if it failed. You can use Application.GetLastError() to determine whether this action failed, and why.

Example:
-- adjust the port number
res = Socket.SetPort("myServerSocket", 510);
error = Application.GetLastError();
if (error == 0) then
    Dialog.Message("Info", "Server will listen on port 510!", MB_OK);
else
    Dialog.Message("Error", "Server already running? Got error " .. error, MB_OK);
end


Socket.StartClient()
Socket.StartClient(string ObjectName);

Description:

Initializes a client socket, in order to allow the generation of On Read and On Close events. You will need to use this if you want to handle incoming data on the socket, but are unable (or unwilling) to perform a looping Socket.Read() that would block the application when no data is available.

ObjectName:

(string) The name of the socket object.

Returns:

(boolean) True if the socket was correctly set up, and the communication window could be created and linked to the socket, enabling the event-driven programming, or false if there was some kind of error. You can use Application.GetLastError() to determine whether this action failed, and why.

Example:
-- set up events for incoming data
res = Socket.StartClient("myClientSocket");
if res then
    Dialog.Message("info", "Events should fire normally", MB_OK);
else
    Dialog.Message("error", "Could not set up client socket", MB_OK);
end


Socket.StartServer()
Socket.StartServer(string ObjectName);

Description:

Initializes a server socket, allowing incoming connections. The server socket will generate On Accept , On Read and On Close events.

ObjectName:

(string) The name of the socket object.

Returns:

(boolean) True if the socket was correctly set up, and the communication window could be created and linked to the socket, enabling the event-driven programming, or false if there was some kind of error. You can use Application.GetLastError() to determine whether this action failed, and why.

Example:
-- accept incoming connections
res = Socket.StartServer("myServerSocket");
if res then
    Dialog.Message("info", "Now listening for clients", MB_OK);
else
    Dialog.Message("error", "Could not set up server socket", MB_OK);
end


Socket.StopClient()
Socket.StopClient(string ObjectName);

Description:

Stops a client socket, so it won't generate any new events. The current connection to the remote socket will be dropped. You should use this if the client socket was previously started with Socket.StartClient() . If it wasn't, use Socket.Close() instead to drop the connection.

ObjectName:

(string) The name of the socket object.

Returns:

(boolean) True if the socket was correctly closed, or false if there was some kind of error. You can use Application.GetLastError() to determine whether this action failed, and why.

Example:
-- do not create new events and close the socket
res = Socket.StopClient("myClientSocket");
if res then
    Dialog.Message("info", "Client socket closed", MB_OK);
else
    Dialog.Message("error", "Some error occurred", MB_OK);
end


Socket.StopServer()
Socket.StopServer(string ObjectName);

Description:

Stops a server socket, so it won't accept any new connections. At the same time, all currently connected clients will be dropped.

ObjectName:

(string) The name of the socket object.

Returns:

(boolean) True if the socket was correctly closed, or false if there was some kind of error. You can use Application.GetLastError() to determine whether this action failed, and why.

Example:
-- do not accept new connections
res = Socket.StopServer("myServerSocket");
if res then
    Dialog.Message("info", "All clients disconnected", MB_OK);
else
    Dialog.Message("error", "Some error occurred", MB_OK);
end


Chat Client
Example code for a chat client

This example shows a working chat client for a multi-user chat room. The ip address and port number is automatically retrieved from the central server.

New messages are displayed as they are received, even while you are typing a new text. Only the last 12 messages are displayed on a transparent web object, which allows you to set colors and different fonts for each user, if you wish.

You may download the source code here:
http://www.mindquake.com.br/files/ams/Socket-ChatClient.apz


Chat Server
Example code for a chat server

This example shows a working chat server for a multi-user chat room. The server announces itself to the internet and the connection parameters (ip address, port number) may be retrieved by the chat clients using the same nickname.

New messages received from any client are immediately echoed to all connected chat clients, in the same order as they are received. The server interface shows the connected clients (handle number and remote ip address), and offers the possibility to kick (disconnect) users individually.

The server re-publishes itself after 5 hours and 50 minutes, before the initial announcement expires (after 6 hours), using the Page.Timer().

You may download the source code here:
http://www.mindquake.com.br/files/ams/Socket-ChatServer.apz


POP3 Client
Example code for a POP3 client

Here is an example project that implements part of the POP3 mail protocol. You will be able to connect to a remote mail server, and retrieve the number of messages, the size of the mailbox, and information (sender, subject) of the 12 most recent messages received.

You may download the source code here:
http://www.mindquake.com.br/files/ams/Socket-POP3Client.apz


SMTP Client
Example code for a SMTP client

Here is an example project that implements part of the SMTP mail protocol. You will be able to send a single message to a remote mailbox. This demo, for sake of simplicity, makes some assumptions that have to be satisfied (or you get error messages), but you should be able to enhance this script to fit your needs.

Please note that, while the sample program obeys the SMTP standard, messages sent with it may be classified as spam, so you should check your junk folder when testing. Other ISPs may block your message completely, because end users are not supposed to deliver mail directly, but should using their ISP's mail servers instead as mail relays.

You may download the source code here:
http://www.mindquake.com.br/files/ams/Socket-SMTPClient.apz


Ping
Example code for Ping

This example shows how to send raw ICMP packets (echo requests) to a remote computer. You may contact the computer by IP address or name as published in the DNS.

You may download the source code here:
http://www.mindquake.com.br/files/ams/Socket-Ping.apz


How to buy
How to buy / Product activation

This plugin may be freely evaluated for two weeks, so you can test if it fits your needs and if it works as expected. After the evaluation period is over, a dialog like this will be displayed automatically upon start:

This dialog can be accessed as well through the Properties dialog, if the plugin is still working in evaluation mode, so you may unlock it before it stops working.

To unlock the plugin on your computer, you will have to inform the two hexadecimal codes shown in the dialog, identified as Site code and MID. The contents of both fields are required to create a valid activation code, which will allow you to use the plugin on this computer indefinitely in the development environment. As usual, no license is required for the applications that you deploy using this plugin.

The cost for a single license of the Socket Object Plugin is US$ 29.95. One license allows you to request up to two unlock codes, like one for your desktop and another for your portable computer (or one for use at home, and another for the office).

Please use the form below to order an activation code. The payment will be processed safely by PayPal.

Site code:
MID:

The activation code must be processed manually, so please do not expect a reply immediately. The information to unlock the plugin will be sent per email as soon as possible: After your payment is received, it should never take more than 24 hours to get your code.

Once you unlocked the plugin, future versions may be installed on the same computer and should show as activated immediately.


Error Codes
 Previous Top
Windows sockets error codes
Plugin Error codes
10004 - WSAEINTR
10009 - WSAEBADF
10013 - WSAEACCES
10014 - WSAEFAULT
10022 - WSAEINVAL
10024 - WSAEMFILE
10035 - WSAEWOULDBLOCK
10036 - WSAEINPROGRESS
10037 - WSAEALREADY
10038 - WSAENOTSOCK
10039 - WSAEDESTADDRREQ
10040 - WSAEMSGSIZE
10041 - WSAEPROTOTYPE
10042 - WSAENOPROTOOPT
10043 - WSAEPROTONOSUPPORT
10044 - WSAESOCKTNOSUPPORT
10045 - WSAEOPNOTSUPP
10046 - WSAEPFNOSUPPORT
10047 - WSAEAFNOSUPPORT
10048 - WSAEADDRINUSE
10049 - WSAEADDRNOTAVAIL
10050 - WSAENETDOWN
10051 - WSAENETUNREACH
10052 - WSAENETRESET
10053 - WSAECONNABORTED
10054 - WSAECONNRESET
10055 - WSAENOBUFS
10056 - WSAEISCONN
10057 - WSAENOTCONN
10058 - WSAESHUTDOWN
10059 - WSAETOOMANYREFS
10060 - WSAETIMEDOUT
10061 - WSAECONNREFUSED
10062 - WSAELOOP
10063 - WSAENAMETOOLONG
10064 - WSAEHOSTDOWN
10065 - WSAEHOSTUNREACH
10066 - WSAENOTEMPTY
10067 - WSAEPROCLIM
10068 - WSAEUSERS
10069 - WSAEDQUOT
10070 - WSAESTALE
10071 - WSAEREMOTE
10091 - WSASYSNOTREADY
10092 - WSAVERNOTSUPPORTED
10093 - WSANOTINITIALISED
10101 - WSAEDISCON
10102 - WSAENOMORE
10103 - WSAECANCELLED
10104 - WSAEINVALIDPROCTABLE
10105 - WSAEINVALIDPROVIDER
10106 - WSAEPROVIDERFAILEDINIT
10107 - WSASYSCALLFAILURE
10108 - WSASERVICE_NOT_FOUND
10109 - WSATYPE_NOT_FOUND
10110 - WSA_E_NO_MORE
10111 - WSA_E_CANCELLED
10112 - WSAEREFUSED
11001 - WSAHOST_NOT_FOUND
11002 - WSATRY_AGAIN
11003 - WSANO_RECOVERY
11004 - WSANO_DATA
13001 - Could not create socket
13002 - Socket already started
13003 - Nickname is in use
13004 - Could not announce
13005 - Incorrect socket type for action
13006 - Invalid socket
13007 - Nothing to read
13008 - No client connected
13009 - Already connected
13010 - Not connected
13011 - Server not found
13012 - Server socket not active
13013 - Server socket not published
13014 - Could not find socket
13015 - Connection failed
13016 - Invalid port number
13017 - Invalid maximum clients
13018 - Received unexpected ICMP package
13100 - Internal error

You will find the full documentation of the Winsock messages on Microsoft's MSDN website .