update main to use this function
authorDrutu Bogdan <bcristia@adobe.com>
Sat, 18 Dec 2010 16:25:44 +0000 (18:25 +0200)
committerRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Sat, 2 Apr 2011 07:27:23 +0000 (10:27 +0300)
src/main.c

index 8f9839f..7276047 100644 (file)
@@ -1,10 +1,25 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <unistd.h>
+
 #include "lib_swift.h"
 
 int main()
 {
-       f();
+       Swift s = socketSwift();
+       struct sockaddr_in si_other;
+       socklen_t slen = sizeof(si_other);
+       
+       char buf[100];
+       
+       recvfromSwift(s,buf,100,0,(struct sockaddr *)&si_other,&slen);
+       
+       printf("Received packet from %s:%d\nData: %s\n\n", 
+               inet_ntoa(si_other.sin_addr), ntohs(si_other.sin_port), buf);
        
        return 0;
 }