Socket related utility functions for Windows. See psock.h. More...
#include <windows.h>#include <winsock.h>#include <stdio.h>#include <string.h>#include "skinkit.h"#include "psock.h"#include "file.h"Functions | |
| static int32 | map_errno (int err) |
| Maps platform dependent error codes to platform independent error codes. | |
| int32 | PKSocketInit (int32 *pError) |
| Performs any platform-specific initialization required to use sockets. More... | |
| int32 | PKSocketFinalize (int32 *pError) |
| Performs any platform-specific finalization required to use sockets. More... | |
| DEVICE_FILEDESCRIPTOR | PKOpenServerSocket (int32 port, int32 *pError) |
| Opens a socket and sets it to listen for connections. More... | |
| DEVICE_FILEDESCRIPTOR | PKOpenClientSocket (const uint8 *pbzAddr, int32 port, int32 *pError) |
| Opens a socket connection using the specified address and port. More... | |
| DEVICE_FILEDESCRIPTOR | PKAcceptConnection (DEVICE_FILEDESCRIPTOR descriptor, int32 *pError) |
| Blocks waiting for an incoming connection. More... | |
| int32 | PKReadSocket (DEVICE_FILEDESCRIPTOR descriptor, uint8 *buff, int32 len, int32 *pError) |
| Reads data from a socket. More... | |
| int32 | PKWriteSocket (DEVICE_FILEDESCRIPTOR descriptor, uint8 *buff, int32 len, int32 *pError) |
| Writes data to a socket. More... | |
| int32 | PKCloseSocket (DEVICE_FILEDESCRIPTOR descriptor, int32 *pError) |
| Closes a socket. More... | |
Socket related utility functions for Windows. See psock.h.
| DEVICE_FILEDESCRIPTOR PKAcceptConnection | ( | DEVICE_FILEDESCRIPTOR | descriptor, |
| int32 * | pError | ||
| ) |
Blocks waiting for an incoming connection.
| [in] | descriptor | Socket descriptor, as returned by PKOpenSocket() |
| [out] | pError | Set to an error code if operations fails |
| int32 PKCloseSocket | ( | DEVICE_FILEDESCRIPTOR | descriptor, |
| int32 * | pError | ||
| ) |
Closes a socket.
| [in] | descriptor | Socket descriptor, as returned by PKAcceptConnection() |
| [out] | pError | Set to an error code if operations fails |
| DEVICE_FILEDESCRIPTOR PKOpenClientSocket | ( | const uint8 * | pbzAddr, |
| int32 | port, | ||
| int32 * | pError | ||
| ) |
Opens a socket connection using the specified address and port.
| [in] | pbzAddr | The IP address to use when connecting. |
| [in] | port | Port number |
| [out] | pError | Set to an error code if operations fails |
| DEVICE_FILEDESCRIPTOR PKOpenServerSocket | ( | int32 | port, |
| int32 * | pError | ||
| ) |
Opens a socket and sets it to listen for connections.
Once a connection is established use PKAcceptConnection() to accept it.
| [in] | port | Port number |
| [out] | pError | Set to an error code if operations fails |
| int32 PKReadSocket | ( | DEVICE_FILEDESCRIPTOR | descriptor, |
| uint8 * | buff, | ||
| int32 | len, | ||
| int32 * | pError | ||
| ) |
Reads data from a socket.
| [in] | descriptor | Socket descriptor, as returned by PKAcceptConnection() |
| [in] | buff | Buffer to read data into |
| [in] | len | Size of buff |
| [out] | pError | Set to an error code if operations fails |
Performs any platform-specific finalization required to use sockets.
| [out] | pError | Set to an error code if operations fails |
Performs any platform-specific initialization required to use sockets.
| [out] | pError | Set to an error code if operations fails |
| int32 PKWriteSocket | ( | DEVICE_FILEDESCRIPTOR | descriptor, |
| uint8 * | buff, | ||
| int32 | len, | ||
| int32 * | pError | ||
| ) |
Writes data to a socket.
| [in] | descriptor | Socket descriptor, as returned by PKAcceptConnection() |
| [in] | buff | Buffer of data to write |
| [in] | len | Size of buff |
| [out] | pError | Set to an error code if operations fails |