1 #ifndef __SOCKET_UDP_OUTGOING_H__
2 #define __SOCKET_UDP_OUTGOING_H__
4 #include "config_nativenet.h"
23 inline bool Send(
const char * data,
int len);
25 inline bool Send(
const string &data);
27 inline bool InitNoAddress();
29 inline bool SendTo(
const char * data,
int len,
const Socket_Address & address);
31 inline bool SendTo(
const string &data,
const Socket_Address & address);
32 inline bool SetToBroadCast();
38 static void init_type() {
39 Socket_IP::init_type();
40 register_type(_type_handle,
"Socket_UDP_Outgoing",
41 Socket_IP::get_class_type());
44 return get_class_type();
46 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
61 if (setsockopt(_socket, SOL_SOCKET, SO_BROADCAST, (
char *)&optval,
sizeof(optval)) != 0)
77 if (DO_CONNECT(_socket, &address.GetAddressInfo()) != 0)
92 _socket = DO_NEWUDP();
93 if (_socket == BAD_SOCKET)
109 return (DO_SOCKET_WRITE(_socket, data, len) == len);
121 return Send(data.data(), data.size());
135 return (DO_SOCKET_WRITE_TO(_socket, data, len, &address.GetAddressInfo()) == len);
148 return SendTo(data.data(), data.size(), address);
151 #endif //__SOCKET_UDP_OUTGOING_H__
bool InitNoAddress()
This will set a udp up for targeted sends.
Base functionality for a INET domain Socket this call should be the starting point for all other unix...
bool SetToBroadCast()
Ask the OS to let us receive BROADCASt packets on this port.
bool Send(const char *data, int len)
Send data to connected address.
Base functionality for a UDP Sending Socket.
bool InitToAddress(const Socket_Address &address)
Connects the Socket to a Specified address.
A simple place to store and munipulate tcp and port address for communication layer.
void Close()
closes a socket if it is open (allocated)
TypeHandle is the identifier used to differentiate C++ class types.
bool SendTo(const char *data, int len, const Socket_Address &address)
Send data to specified address.