|
|
|
@ -6,6 +6,7 @@
|
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
#include <netdb.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <unistd.h> /* close() */
|
|
|
|
@ -93,6 +94,16 @@ long int UDP::Read(string *source, char *buffer, long int len) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int UDP::SetBlocked(int bl) {
|
|
|
|
|
int flags = fcntl(sock, F_GETFL, 0);
|
|
|
|
|
|
|
|
|
|
if (bl) flags &= ~O_NONBLOCK;
|
|
|
|
|
else flags |= O_NONBLOCK;
|
|
|
|
|
|
|
|
|
|
return fcntl(sock, F_SETFL, flags | O_NONBLOCK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long int UDP::Write(string destaddr, char *buffer, long int len) {
|
|
|
|
|
int s;
|
|
|
|
|
int addrlen = sizeof (struct sockaddr_in);
|
|
|
|
|