summaryrefslogtreecommitdiff
path: root/gnuradio-core/src
diff options
context:
space:
mode:
authoreb2007-01-27 18:21:55 +0000
committereb2007-01-27 18:21:55 +0000
commit2d452df22ba3225a5560b5044f30f09c96a95342 (patch)
tree63800d38d503a16f66022343e6256021053f889d /gnuradio-core/src
parent10157d34bf9c2216d55d75d4d3d0d65ed90b606d (diff)
downloadgnuradio-2d452df22ba3225a5560b5044f30f09c96a95342.tar.gz
gnuradio-2d452df22ba3225a5560b5044f30f09c96a95342.tar.bz2
gnuradio-2d452df22ba3225a5560b5044f30f09c96a95342.zip
fixed error handling and warning
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@4297 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gnuradio-core/src')
-rw-r--r--gnuradio-core/src/lib/io/gr_udp_sink.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/gnuradio-core/src/lib/io/gr_udp_sink.cc b/gnuradio-core/src/lib/io/gr_udp_sink.cc
index a664615f1..43d0dd664 100644
--- a/gnuradio-core/src/lib/io/gr_udp_sink.cc
+++ b/gnuradio-core/src/lib/io/gr_udp_sink.cc
@@ -85,14 +85,14 @@ gr_udp_sink::open()
omni_mutex_lock l(d_mutex); // hold mutex for duration of this function
// create socket
- if((d_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == NULL) {
+ if((d_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
perror("socket open");
throw std::runtime_error("can't open socket");
}
// Turn on reuse address
bool opt_val = true;
- if(setsockopt(d_socket, SOL_SOCKET, SO_REUSEADDR, (void*)&opt_val, sizeof(int))) {
+ if(setsockopt(d_socket, SOL_SOCKET, SO_REUSEADDR, (void*)&opt_val, sizeof(int)) == -1) {
perror("SO_REUSEADDR");
throw std::runtime_error("can't set socket option SO_REUSEADDR");
}
@@ -101,19 +101,19 @@ gr_udp_sink::open()
linger lngr;
lngr.l_onoff = 1;
lngr.l_linger = 0;
- if(setsockopt(d_socket, SOL_SOCKET, SO_LINGER, (void*)&lngr, sizeof(linger))) {
+ if(setsockopt(d_socket, SOL_SOCKET, SO_LINGER, (void*)&lngr, sizeof(linger)) == -1) {
perror("SO_LINGER");
throw std::runtime_error("can't set socket option SO_LINGER");
}
// bind socket to an address and port number to listen on
- if(bind (d_socket, (sockaddr*)&d_sockaddr_local, sizeof(struct sockaddr))) {
+ if(bind (d_socket, (sockaddr*)&d_sockaddr_local, sizeof(struct sockaddr)) == -1) {
perror("socket bind");
throw std::runtime_error("can't bind socket");
}
// Not sure if we should throw here or allow retries
- if(connect(d_socket, (sockaddr*)&d_sockaddr_remote, sizeof(struct sockaddr))) {
+ if(connect(d_socket, (sockaddr*)&d_sockaddr_remote, sizeof(struct sockaddr)) == -1) {
perror("socket connect");
throw std::runtime_error("can't connect to socket");
}
@@ -145,7 +145,7 @@ gr_udp_sink::work (int noutput_items,
while(bytes_sent < total_size) {
bytes_to_send = (bytes_sent+d_mtu < total_size ? d_mtu : total_size-bytes_sent);
- bytes =send(d_socket, (in+bytes_sent), bytes_to_send, MSG_DONTWAIT);
+ bytes = send(d_socket, (in+bytes_sent), bytes_to_send, MSG_DONTWAIT);
bytes_sent += bytes;
}