tcpdump -A -u port 9877 -i iface
 
  tcpdump -A -u port 9877 -i iface
   −
Modified version of the UDP server linked above, which sends replies:
+
Modified version of the UDP server linked above, which sends replies (and compiles without warnings):
 
<pre>
 
<pre>
 
#include <arpa/inet.h>
 
#include <arpa/inet.h>
 
#include <sys/socket.h>
 
#include <sys/socket.h>
 
#include <unistd.h>
 
#include <unistd.h>
 +
#include <stdlib.h>
 +
#include <string.h>
    
#define BUFLEN 512
 
#define BUFLEN 512
 
#define NPACK 10
 
#define NPACK 10
#define PORT 9930
+
#define PORT 9930
 +
 
 +
void diep(char *s)
 +
{
 +
perror(s);
 +
exit(1);
 +
}
   −
void diep(char *s)
  −
{
  −
  perror(s);
  −
  exit(1);
  −
}
     −
int main(void)
+
int main(void)
{
+
{
  struct sockaddr_in si_me, si_other;
+
struct sockaddr_in si_me, si_other;
  int s, i, slen=sizeof(si_other);
+
int s, i, slen=sizeof(si_other);
  char buf[BUFLEN];
+
char buf[BUFLEN];
   −
  if ((s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1)
+
if ((s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1)
    diep("socket");
+
diep("socket");
   −
  memset((char *) &si_me, 0, sizeof(si_me));
+
memset((char *) &si_me, 0, sizeof(si_me));
  si_me.sin_family = AF_INET;
+
si_me.sin_family = AF_INET;
  si_me.sin_port = htons(PORT);
+
si_me.sin_port = htons(PORT);
  si_me.sin_addr.s_addr = htonl(INADDR_ANY);
+
si_me.sin_addr.s_addr = htonl(INADDR_ANY);
  if (bind(s, &si_me, sizeof(si_me))==-1)
+
if (bind(s, (struct sockaddr*)&si_me, sizeof(si_me))==-1)
      diep("bind");
+
diep("bind");
   Exception encountered, of type "Error"