215 return (0 != this->
sock);
The common base class of Nebula.
Definition refcounted.h:38
Represents an IP address, consisting of a IPv4 host address and a port number.
Platform independent wrapper class for the Sockets API.
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Represents an IP address, consisting of a IPv4 host address and a port number.
Definition win32ipaddress.h:32
A lowlevel socket wrapper class.
Definition win32socket.h:27
__DeclareClass(Win32Socket)
bool GetBroadcast()
get the broadcast flag
Definition win32socket.h:269
SizeT GetMaxMsgSize()
get the maximum message size that can be sent atomically
Definition win32socket.h:368
Net::IpAddress addr
Definition win32socket.h:204
bool GetReUseAddr()
get reuseaddr flag
Definition win32socket.h:305
Win32Socket()
constructor
Definition win32socket.cc:19
Result
Definition win32socket.h:39
@ Success
Definition win32socket.h:41
@ Closed
Definition win32socket.h:43
@ Error
Definition win32socket.h:40
@ WouldBlock
Definition win32socket.h:42
bool GetBlocking() const
get blocking mode
Definition win32socket.h:377
bool IsOpen() const
return true if the socket is open
Definition win32socket.h:213
static Util::String ErrorAsString(ErrorCode err)
convert error code to human readable string
Definition win32socket.cc:664
void Close()
close the socket
Definition win32socket.cc:117
ErrorCode
error codes
Definition win32socket.h:48
@ ErrorDestAddrRequired
Definition win32socket.h:60
@ ErrorIsShutdown
Definition win32socket.h:79
@ ErrorAddrFamilyNotSupported
Definition win32socket.h:68
@ ErrorProtFamilyNotSupported
Definition win32socket.h:67
@ ErrorVersionNotSupported
Definition win32socket.h:86
@ ErrorBadProtocolOption
Definition win32socket.h:63
@ ErrorHostDown
Definition win32socket.h:82
@ ErrorSystemNotReady
Definition win32socket.h:85
@ ErrorMsgTooLong
Definition win32socket.h:61
@ ErrorAddrInUse
Definition win32socket.h:69
@ ErrorIsConnected
Definition win32socket.h:77
@ ErrorNetDown
Definition win32socket.h:71
@ ErrorInProgress
Definition win32socket.h:57
@ ErrorHostNotFound
Definition win32socket.h:90
@ ErrorPermissionDenied
Definition win32socket.h:52
@ ErrorWouldBlock
Definition win32socket.h:56
@ ErrorIsTimedOut
Definition win32socket.h:80
@ ErrorTooManyProcesses
Definition win32socket.h:84
@ ErrorNoData
Definition win32socket.h:93
@ ErrorSocketTypeNotSupported
Definition win32socket.h:65
@ ErrorInterrupted
Definition win32socket.h:51
@ ErrorTooManyOpenFiles
Definition win32socket.h:55
@ ErrorNetUnreachable
Definition win32socket.h:72
@ ErrorHostUnreachable
Definition win32socket.h:83
@ ErrorNotConnected
Definition win32socket.h:78
@ ErrorDisconnecting
Definition win32socket.h:88
@ ErrorConnectionReset
Definition win32socket.h:75
@ ErrorConnectionRefused
Definition win32socket.h:81
@ ErrorTryAgain
Definition win32socket.h:91
@ ErrorNotASocket
Definition win32socket.h:59
@ ErrorNetReset
Definition win32socket.h:73
@ ErrorNoBufferSpace
Definition win32socket.h:76
@ ErrorNotInitialized
Definition win32socket.h:87
@ ErrorAlreadyInProgress
Definition win32socket.h:58
@ ErrorProtocolNotSupported
Definition win32socket.h:64
@ ErrorNone
Definition win32socket.h:49
@ ErrorOperationNotSupported
Definition win32socket.h:66
@ ErrorConnectionAborted
Definition win32socket.h:74
@ ErrorBadAddress
Definition win32socket.h:53
@ ErrorInvalidArgument
Definition win32socket.h:54
@ ErrorTypeNotFound
Definition win32socket.h:89
@ ErrorInvalidProtocol
Definition win32socket.h:62
@ ErrorUnknown
Definition win32socket.h:50
@ ErrorNoRecovery
Definition win32socket.h:92
@ ErrorAddrNotAvailable
Definition win32socket.h:70
bool isBlocking
Definition win32socket.h:205
ErrorCode GetErrorCode() const
get the last error code
Definition win32socket.h:251
int GetIntOption(int optName)
get an integer socket option
Definition win32socket.cc:219
void SetNoDelay(bool b)
set nodelay flag (TCP_NODELAY)
Definition win32socket.h:314
void SetKeepAlive(bool b)
set the keepalive flag (SO_KEEPALIVE)
Definition win32socket.h:278
bool Accept(Ptr< Net::Socket > &outSocket)
accept incoming connection, return a new socket (for server sockets)
Definition win32socket.cc:308
static ErrorCode WSAErrorToErrorCode(int wsaError)
convert a WSA error code to internal error code
Definition win32socket.cc:606
Result RecvFrom(void *buf, SizeT bufSize, uint addr, ushort port, SizeT &bytesReceived)
receive raw data from address for connectionless sockets
Definition win32socket.cc:564
void SetBroadcast(bool b)
set the broadcast flag (SO_BROADCAST)
Definition win32socket.h:260
Result Send(const void *buf, SizeT numBytes, SizeT &bytesSent)
send raw data into the socket
Definition win32socket.cc:431
bool GetBoolOption(int optName)
get a bool socket option
Definition win32socket.cc:176
SOCKET sock
Definition win32socket.h:203
void SetToLastWSAError()
set error code to WSAGetLastError();
Definition win32socket.cc:585
bool IsBound() const
return true if the socket is bound to an address
Definition win32socket.h:222
void SetReUseAddr(bool b)
set reuseaddr flag (SO_REUSEADDR)
Definition win32socket.h:296
Protocol
protocol types
Definition win32socket.h:32
@ UDP
Definition win32socket.h:34
@ TCP
Definition win32socket.h:33
void ClearError()
clear the last error code
Definition win32socket.cc:575
Util::String GetErrorString() const
get the last error string
Definition win32socket.cc:732
void SetAddress(const Net::IpAddress &a)
set internet address of socket
Definition win32socket.h:232
static Util::String WSAErrorToString(int wsaError)
convert WSA error code directly to string
Definition win32socket.cc:723
SizeT GetRecvBufSize()
get receive buffer size
Definition win32socket.h:341
void OpenWithExistingSocket(SOCKET s)
open with an existing socket (called by Accept())
Definition win32socket.cc:106
void SetRecvBufSize(SizeT s)
set receive buffer size
Definition win32socket.h:332
static bool IsNetworkInitialized()
is network initialized
Definition win32socket.cc:741
bool Open(Protocol p)
open the socket
Definition win32socket.cc:64
void SetBlocking(bool b)
set blocking mode (FIONBIO)
Definition win32socket.cc:240
static bool NetworkInitialized
Definition win32socket.h:201
static void InitNetwork()
static initializer method (called by SysFunc::Setup())
Definition win32socket.cc:46
Result SendTo(const void *buf, SizeT numBytes, uint addr, ushort port, SizeT &bytesSent)
send raw data to address for connectionless sockets
Definition win32socket.cc:552
bool HasRecvData()
return true if recv data is available at the socket
Definition win32socket.cc:465
Result Recv(void *buf, SizeT bufSize, SizeT &bytesReceived)
receive raw data from the socket
Definition win32socket.cc:503
bool GetKeepAlive()
get the keepalive flag
Definition win32socket.h:287
SizeT GetSendBufSize()
get send buffer size
Definition win32socket.h:359
bool Bind()
bind socket to ip address
Definition win32socket.cc:262
void SetWSAError(int wsaError)
set WSA error code
Definition win32socket.cc:595
void SetIntOption(int optName, int val)
set an integer socket option
Definition win32socket.cc:202
Result Connect()
connect to the sockets address (for client sockets)
Definition win32socket.cc:355
const Net::IpAddress & GetAddress() const
get internet address of socket
Definition win32socket.h:242
bool Listen()
listen for incoming connections (for server sockets)
Definition win32socket.cc:285
bool isBound
Definition win32socket.h:206
virtual ~Win32Socket()
destructor
Definition win32socket.cc:31
bool GetNoDelay()
get nodelay flag
Definition win32socket.h:323
ErrorCode error
Definition win32socket.h:202
void SetSendBufSize(SizeT s)
set send buffer size
Definition win32socket.h:350
void SetBoolOption(int optName, bool val)
set a bool socket option
Definition win32socket.cc:152
bool IsConnected()
test if the socket is currently connected
Definition win32socket.cc:399
Definition debugmessage.h:20
[TODO: Describe Win32 subsystem]
Nebula's universal string class.
Definition string.h:50
int SizeT
Definition types.h:49
unsigned int uint
Definition types.h:31
unsigned short ushort
Definition types.h:32