TcpLib
Loading...
Searching...
No Matches
tcp Namespace Reference

Classes

class  AbstractMessage
 Base class for messages which can be sent, received and processed by the Tcp-classes. More...
 
class  Client
 A simple TCP client class, which should learn its know-how in the derived classes. More...
 
class  ClientReceiver
 Class that communicates with a Server via a SOCKET and delivers its receive result of type Message to its "owner", which must be a Client. You can use the method ClientReceiver::acceptMessage(AbstractMessage * pTcpMessage) to change the delivery to the "owner" in subclasses by overwriting the method. More...
 
class  DataReceiver
 Superclass for all TcpReceiver that communicate via a SOCKET and deliver their receive result, a type derived from AbstractMessage, to their "owner".
Since a message can be composed (it is a stream, which may be delivered in chunks), a buffer is created here, which contains data as long as the stream is not complete. More...
 
class  Message
 Contains a data stream which can be sent and received by the Tcp classes. More...
 
class  Receiver
 Superclass for all TcpReceiver that communicate via a SOCKET and deliver their receive result to their parent object. More...
 
class  ReceiverTransmitter
 Superclass for all Receiver and Transmitter, which communicate via a SOCKET. More...
 
class  Server
 A simple TCP server class, which should learn its know-how in the derived classes. More...
 
class  ServerAcceptMessage
 A special Tcp message, with which the ServerAcceptReceiver can register a new Client. More...
 
class  ServerAcceptReceiver
 Accept-Receiver accepts new clients and registers them with its parent object (usually a Server or a subclass of it). More...
 
class  ServerMessage
 Is a special Tcp message for the Server. The socket is included so that the server knows to whom it should send the data. More...
 
class  ServerReceiver
 Class that communicates with a Client via a SOCKET and delivers its receive result of type ServerMessage to its "owner", which must be a Server. You can use the method ServerReceiver::acceptMessage(AbstractMessage * pTcpMessage) to change the delivery to the "owner" in subclasses by overwriting the method. More...
 
class  TcpMain
 Superclass for Client and Server, which 'learns' its know-how in the derived classes. More...
 
class  Transmitter
 A class that communicates with a Client or Server via a SOCKET and expects send data of type Message. More...
 

Enumerations

enum  ERRORS {
  ERR_WSAEINTR = -10004 , ERR_WSAEBADF = -10009 , ERR_WSAEACCES = -10013 , ERR_WSAEFAULT = -10014 ,
  ERR_WSAEINVAL = -10022 , ERR_WSAEMFILE = -10024 , ERR_WSAEWOULDBLOCK = -10035 , ERR_WSAEINPROGRESS = -10036 ,
  ERR_WSAEALREADY = -10037 , ERR_WSAENOTSOCK = -10038 , ERR_WSAEDESTADDRREQ = -10039 , ERR_WSAEMSGSIZE = -10040 ,
  ERR_WSAEPROTOTYPE = -10041 , ERR_WSAENOPROTOOPT = -10042 , ERR_WSAEPROTONOSUPPORT = -10043 , ERR_WSAESOCKTNOSUPPORT = -10044 ,
  ERR_WSAEOPNOTSUPP = -10045 , ERR_WSAEPFNOSUPPORT = -10046 , ERR_WSAEAFNOSUPPORT = -10047 , ERR_WSAEADDRINUSE = -10048 ,
  ERR_WSAEADDRNOTAVAIL = -10049 , ERR_WSAENETDOWN = -10050 , ERR_WSAENETUNREACH = -10051 , ERR_WSAENETRESET = -10052 ,
  ERR_WSAECONNABORTED = -10053 , ERR_WSAECONNRESET = -10054 , ERR_WSAENOBUFS = -10055 , ERR_WSAEISCONN = -10056 ,
  ERR_WSAENOTCONN = -10057 , ERR_WSAESHUTDOWN = -10058 , ERR_WSAETOOMANYREFS = -10059 , ERR_WSAETIMEDOUT = -10060 ,
  ERR_WSAECONNREFUSED = -10061 , ERR_WSAELOOP = -10062 , ERR_WSAENAMETOOLONG = -10063 , ERR_WSAEHOSTDOWN = -10064 ,
  ERR_WSAEHOSTUNREACH = -10065 , ERR_WSAENOTEMPTY = -10066 , ERR_WSAEPROCLIM = -10067 , ERR_WSAEUSERS = -10068 ,
  ERR_WSAEDQUOT = -10069 , ERR_WSAESTALE = -10070 , ERR_WSAEREMOTE = -10071 , ERR_WSASYSNOTREADY = -10091 ,
  ERR_WSAVERNOTSUPPORTED = -10092 , ERR_WSANOTINITIALISED = -10093 , ERR_WSAHOST_NOT_FOUND = -11001 , ERR_WSATRY_AGAIN = -11002 ,
  ERR_WSANO_RECOVERY = -11003 , ERR_WSANO_DATA = -11004 , ERR_PARAMETER_NULL_FORBIDDEN = -10101 , ERR_SOCKET_ALREADY_EXISTING = -10102 ,
  ERR_SOCKET_NOT_EXISTING = -10103 , ERR_NO_HOSTNAME = -10104 , ERR_UNKNOWN_HOSTNAME = -10105 , ERR_NO_PORT = -10106 ,
  ERR_ALLREADY_CONNECTED = -10107 , ERR_CONNECTION_BROKEN = -10108 , ERR_NO_DATASIZE = -10109 , ERR_MAX_CLIENTS_TO_LOW = -10110 ,
  ERR_NO_SOCKETINDEX = -10111 , ERR_WRONG_STREAMTYPE = -10112 , ERR_FREE_1 = -10113 , ERR_FREE_2 = -10114 ,
  ERR_NO_TRANSMITTER = -10115 , ERR_NO_RECEIVER = -10116 , ERR_FREE_3 = -10117 , ERR_TO_MUCH_CLIENTS = -10118 ,
  ERR_NO_CORRECT_STREAM_DATA = -10119 , ERR_NO_SERVER_MSG = -10120 , ERR_TIME_OUT = -10121 , ERR_METHOD_FORBIDDEN = -10122 ,
  ERR_GETPEERNAME_FAILED = -10123 , ERR_UNKNOWN = -10200
}
 Error range = -10001 to -10200 More...
 
enum  ActionCode {
  ACTION_UNDEF = 0 , ACTION_SYNC_DATA_SIZE = 1 , ACTION_REQUEST = 2 , ACTION_REQUEST_WITH_RESPONSE = 3 ,
  ACTION_RESPONSE = 4 , ACTION_INFO = 5
}
 

Variables

const std::string sTcpVersion = "1.0.3"
 

Enumeration Type Documentation

◆ ActionCode

Required for Message between client and server to indicate what is wanted.

Enumerator
ACTION_UNDEF 

Undefined action.

ACTION_SYNC_DATA_SIZE 

Action to synchronize the packet size between server and client.

ACTION_REQUEST 

Something is requested from the communication counterpart without waiting for a response.

ACTION_REQUEST_WITH_RESPONSE 

Something is requested from the communication counterpart and a response is waited for.

ACTION_RESPONSE 

Something was requested from the communication counterpart without waiting for a direct response; this is the response.

ACTION_INFO 

An info from the communication counterpart.

◆ ERRORS

Error range = -10001 to -10200

For the socket errors (all from -10004 to -11004) descriptions can be found on the Internet.

For Windows Sockets e.g. under: https://msdn.microsoft.com/de-de/library/windows/desktop/ms740668%28v=vs.85%29.aspx or generally also under: https://gist.github.com/gabrielfalcao/4216897

This list is not complete!

Enumerator
ERR_WSAEINTR 

-10004:

ERR_WSAEBADF 

-10009:

ERR_WSAEACCES 

-10013:

ERR_WSAEFAULT 

-10014:

ERR_WSAEINVAL 

-10022:

ERR_WSAEMFILE 

-10024:

ERR_WSAEWOULDBLOCK 

-10035:

ERR_WSAEINPROGRESS 

-10036:

ERR_WSAEALREADY 

-10037:

ERR_WSAENOTSOCK 

-10038:

ERR_WSAEDESTADDRREQ 

-10039:

ERR_WSAEMSGSIZE 

-10040:

ERR_WSAEPROTOTYPE 

-10041:

ERR_WSAENOPROTOOPT 

-10042:

ERR_WSAEPROTONOSUPPORT 

-10043:

ERR_WSAESOCKTNOSUPPORT 

-10044:

ERR_WSAEOPNOTSUPP 

-10045:

ERR_WSAEPFNOSUPPORT 

-10046:

ERR_WSAEAFNOSUPPORT 

-10047:

ERR_WSAEADDRINUSE 

-10048:

ERR_WSAEADDRNOTAVAIL 

-10049:

ERR_WSAENETDOWN 

-10050:

ERR_WSAENETUNREACH 

-10051:

ERR_WSAENETRESET 

-10052:

ERR_WSAECONNABORTED 

-10053:

ERR_WSAECONNRESET 

-10054:

ERR_WSAENOBUFS 

-10055:

ERR_WSAEISCONN 

-10056:

ERR_WSAENOTCONN 

-10057:

ERR_WSAESHUTDOWN 

-10058:

ERR_WSAETOOMANYREFS 

-10059:

ERR_WSAETIMEDOUT 

-10060:

ERR_WSAECONNREFUSED 

-10061:

ERR_WSAELOOP 

-10062:

ERR_WSAENAMETOOLONG 

-10063:

ERR_WSAEHOSTDOWN 

-10064:

ERR_WSAEHOSTUNREACH 

-10065:

ERR_WSAENOTEMPTY 

-10066:

ERR_WSAEPROCLIM 

-10067:

ERR_WSAEUSERS 

-10068:

ERR_WSAEDQUOT 

-10069:

ERR_WSAESTALE 

-10070:

ERR_WSAEREMOTE 

-10071:

ERR_WSASYSNOTREADY 

-10091:

ERR_WSAVERNOTSUPPORTED 

-10092:

ERR_WSANOTINITIALISED 

-10093:

ERR_WSAHOST_NOT_FOUND 

-11001:

ERR_WSATRY_AGAIN 

-11002:

ERR_WSANO_RECOVERY 

-11003:

ERR_WSANO_DATA 

-11004:

ERR_PARAMETER_NULL_FORBIDDEN 

-10101: A, not allowed, NULL parameter was passed.

ERR_SOCKET_ALREADY_EXISTING 

-10102: A socket to be initialized already exists or is already connected.

ERR_SOCKET_NOT_EXISTING 

-10103: The expected socket does not exist.

ERR_NO_HOSTNAME 

-10104: No host name was passed as parameter.

ERR_UNKNOWN_HOSTNAME 

-10105: The host name is unknown.

ERR_NO_PORT 

-10106: No or no valid port was passed as parameter.

ERR_ALLREADY_CONNECTED 

-10107: The socket connection already exists.

ERR_CONNECTION_BROKEN 

-10108: The socket connection was interrupted.

ERR_NO_DATASIZE 

-10109: An expected data size is NULL.

ERR_MAX_CLIENTS_TO_LOW 

-10110: The maximum number of connections was not set or is 0.

ERR_NO_SOCKETINDEX 

-10111: The Server has not found a client in its client list.

ERR_WRONG_STREAMTYPE 

-10112: A received stream does not have the expected format.

ERR_FREE_1 

-10113:

ERR_FREE_2 

-10114:

ERR_NO_TRANSMITTER 

-10115: The Client has no Transmitter.

ERR_NO_RECEIVER 

-10116: The Server has no ServerReceiver.

ERR_FREE_3 

-10117:

ERR_TO_MUCH_CLIENTS 

-10118: The maximum number of connections was exceeded.

ERR_NO_CORRECT_STREAM_DATA 

-10119: A received stream has incorrect data.

ERR_NO_SERVER_MSG 

-10120: Message passed as parameter is not a server message.

ERR_TIME_OUT 

-10121: The waiting time for an answer has expired (timeout).

ERR_METHOD_FORBIDDEN 

-10122: The method call is prohibited.

ERR_GETPEERNAME_FAILED 

-10123: The peername request failed.

ERR_UNKNOWN 

-10200: Unknown error.

Variable Documentation

◆ sTcpVersion

const std::string tcp::sTcpVersion = "1.0.3"

The version, if new, is changed here.

The file names of the DLL or LIB file are composed of the project name + the compiler identification + the version of the library.

E.g. for Visual Studio 2015 = "$(ProjectName)$(PlatformToolset)101" as target name; if the compile target is "TCP", the name becomes "TCPv140101.dll" and "TCPv140101.lib".