SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | List of all members
SLNet::SocketLayer Class Reference

`#include <slikenet/SocketLayer.h>`

## Public Member Functions

| SocketLayer ()
| Default Constructor.
| ~SocketLayer ()

## Static Public Member Functions

static SLNet::RakString | GetSubNetForSocketAndIp (__UDPSOCKET__ inSock, SLNet::RakString inIpString)
static void | GetMyIP (SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS])
static unsigned short | GetLocalPort (__UDPSOCKET__ s)
static void | GetSystemAddress_Old (__UDPSOCKET__ s, SystemAddress *systemAddressOut)
static void | GetSystemAddress (__UDPSOCKET__ s, SystemAddress *systemAddressOut)
static void | SetSocketOptions (__UDPSOCKET__ listenSocket, bool blockingSocket, bool setBroadcast)
static bool | GetFirstBindableIP (char firstBindable[128], int ipProto)

## Detailed Description

Definition at line 58 of file SocketLayer.h.

## Constructor & Destructor Documentation

SLNet::SocketLayer::SocketLayer | ( |  | ) |

Default Constructor.

SLNet::SocketLayer::~SocketLayer | ( |  | ) |

## Member Function Documentation

bool SocketLayer::GetFirstBindableIP | ( | char | firstBindable[128],
|  | int | ipProto
| ) |  |

static

Definition at line 592 of file SocketLayer.cpp.

References GetMyIP(), MAXIMUM_NUMBER_OF_INTERNAL_IDS, SLNet::SystemAddress::ToString(), and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

unsigned short SocketLayer::GetLocalPort | ( | __UDPSOCKET__ | s | ) |

static

Call sendto (UDP obviously)

Parameters

  [in] | s | the socket
  [in] | data | The byte buffer to send
  [in] | length | The length of the data in bytes
  [in] | ip | The address of the remote host in dotted notation.
  [in] | port | The port number to send to.

Returns
  0 on success, nonzero on failure. Call sendto' (UDP obviously) It won't reach the recipient, except on a LAN However, this is good for opening routers / firewalls

Parameters

  [in] | s | the socket
  [in] | data | The byte buffer to send
  [in] | length | The length of the data in bytes
  [in] | ip | The address of the remote host in dotted notation.
  [in] | port | The port number to send to.
  [in] | ttl | Max hops of datagram

Returns
  0 on success, nonzero on failure. Call sendto (UDP obviously)

Parameters

  [in] | s | the socket
  [in] | data | The byte buffer to send
  [in] | length | The length of the data in bytes
  [in] | binaryAddress | The address of the remote host in binary format.
  [in] | port | The port number to send to.

Returns
  0 on success, nonzero on failure.

Definition at line 487 of file SocketLayer.cpp.

References SLNet::SystemAddress::GetPort(), and GetSystemAddress().

void SocketLayer::GetMyIP | ( | SystemAddress | addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] | ) |

static

Sets the socket flags to nonblocking

Parameters

  [in] | listenSocket | the socket to set Retrieve all local IP address in a string format.
  [in] | s | The socket whose port we are referring to
  [in] | ipList | An array of ip address in dotted notation.

Definition at line 460 of file SocketLayer.cpp.

References GetMyIP_Win32().

Referenced by GetFirstBindableIP().

SLNet::RakString SocketLayer::GetSubNetForSocketAndIp | ( | __UDPSOCKET__ | inSock,
|  | SLNet::RakString | inIpString
| ) |  |

static

Write data of length length to writeSocket

Parameters

  [in] | writeSocket | The socket to write to
  [in] | data | The data to write
  [in] | length | The length of data Read data from a socket
  [in] | s | the socket
  [in] | rakPeer | The instance of rakPeer containing the recvFrom C callback
  [in] | errorCode | An error code if an error occured .
  [in] | connectionSocketIndex | Which of the sockets in RakPeer we are using

Returns
  Returns true if you successfully read data, false on error. Given a socket and IP, retrieves the subnet mask, on linux the socket is unused

Parameters

  [in] | inSock | the socket
  [in] | inIpString | The ip of the interface you wish to retrieve the subnet mask from

Returns
  Returns the ip dotted subnet mask if successful, otherwise returns empty string ("")

Definition at line 195 of file SocketLayer.cpp.

References RakAssert, and socket__.

void SocketLayer::GetSystemAddress | ( | __UDPSOCKET__ | s,
|  | SystemAddress * | systemAddressOut
| ) |  |

static

Definition at line 529 of file SocketLayer.cpp.

References _T, SLNet::SystemAddress::address, SLNet::SystemAddress::debugPort, SLNet::SystemAddress::FromString(), getsockname__, GetSystemAddress_Old(), RAKNET_DEBUG_TPRINTF, and SLNet::SystemAddress::SetToLoopback().

Referenced by GetLocalPort().

void SocketLayer::GetSystemAddress_Old | ( | __UDPSOCKET__ | s,
|  | SystemAddress * | systemAddressOut
| ) |  |

static

Definition at line 493 of file SocketLayer.cpp.

References _T, SLNet::SystemAddress::address, getsockname__, RAKNET_DEBUG_TPRINTF, SLNet::SystemAddress::SetPortNetworkOrder(), and SLNet::UNASSIGNED_SYSTEM_ADDRESS.

Referenced by GetSystemAddress().

void SocketLayer::SetSocketOptions | ( | __UDPSOCKET__ | listenSocket,
|  | bool | blockingSocket,
|  | bool | setBroadcast
| ) |  |

static

Definition at line 125 of file SocketLayer.cpp.

References _T, ioctlsocket__, RAKNET_DEBUG_TPRINTF, and setsockopt__.

The documentation for this class was generated from the following files:

- Source/include/slikenet/SocketLayer.h
- Source/src/SocketLayer.cpp