Simple Socket

Simple Socket

  • Intro
  • Getting Started
  • API
  • GitHub
  • Help

›API

Overview

  • Introduction
  • Building and Installation
  • Getting Started

Examples

  • Application Specific Examples

API

  • Core Socket Functionality
  • General Defitions
  • Common Socket Options

General Defitions

General Defitions for the usage of and interaction with sockets.

Table of Contents

  • Functions
    • length
    • DescribeError
  • Enums
    • CShutdownMode
    • CSocketType
    • CSocketError

Functions

// Calculates the length of a C string at compilation
auto constexpr length( const char* str )->long { return *str ? 1 + length( str + 1 ) : 0; }
/// Returns a human-readable description of the given error code
static std::string DescribeError(CSocketError err);

Enums

CShutdownMode

Defines the three possible states for shuting down a socket.

/// Shutdown shut down socket send and receive operations
///    CShutdownMode::Receives - Disables further receive operations.
///    CShutdownMode::Sends    - Disables further send operations.
///    CShutdownBoth::Both     - Disables further send and receive operations.

CSocketType

Defines the socket types recognized by CSimpleSocket class.

TypeDescriptionNotes
SocketTypeInvalidInvalid socket type.-
SocketTypeTcpDefines socket as TCP socket.-
SocketTypeUdpDefines socket as UDP socket.-
SocketTypeTcp6Defines socket as IPv6 TCP socket.Not Supported
SocketTypeUdp6Defines socket as IPv6 UDP socket.Not Supported
SocketTypeRawProvides raw network protocol access.Linux Only

CSocketError

Defines all error codes handled by the CSimpleSocket class.

ErrorDescription
SocketErrorGeneric socket error translates to error below.
SocketSuccessNo socket error.
SocketInvalidSocketInvalid socket handle.
SocketInvalidAddressInvalid destination address specified.
SocketInvalidPortInvalid destination port specified.
SocketConnectionRefusedNo server is listening at remote address.
SocketTimedoutTimed out while attempting operation.
SocketEwouldblockOperation would block if socket were blocking.
SocketNotconnectedCurrently not connected.
SocketEinprogressSocket is non-blocking and the connection cannot be completed immediately
SocketInterruptedCall was interrupted by a signal that was caught before a valid connection arrived.
SocketConnectionAbortedThe connection has been aborted.
SocketProtocolErrorInvalid protocol for operation.
SocketFirewallErrorFirewall rules forbid connection.
SocketInvalidSocketBufferThe receive buffer point outside the process's address space.
SocketConnectionResetConnection was forcibly closed by the remote host.
SocketAddressInUseAddress already in use.
SocketInvalidPointerPointer type supplied as argument is invalid.
SocketInvalidOperationAn invalid argument was provide for the requested action.
SocketAlreadyConnectedA requested action was not possible because of socket state.
SocketRoutingErrorOS could not resolve route for requested operation
SocketEunknownUnknown error please report to prince.chrismc@gmail.com
← Core Socket FunctionalityCommon Socket Options →
  • Functions
  • Enums
    • CShutdownMode
    • CSocketType
    • CSocketError
Simple Socket
Docs
OverviewGetting StartedAPI Reference
Community
Stack Overflow
More
BlogGitHubStar
Facebook Open Source
Copyright © 2019 Christopher McArthur