|
|
| 21 |
#include <stdio.h> |
21 |
#include <stdio.h> |
| 22 |
#include <sstream> |
22 |
#include <sstream> |
| 23 |
|
23 |
|
|
|
24 |
#include "ns3/net-anim-config.h" |
| 25 |
|
| 26 |
#ifdef MINGW |
| 27 |
#include <fcntl.h> |
| 28 |
#endif |
| 29 |
|
| 24 |
// Socket related includes |
30 |
// Socket related includes |
| 25 |
#include <sys/socket.h> |
31 |
#if defined(HAVE_SYS_SOCKET_H) && defined(HAVE_NETINET_IN_H) |
| 26 |
#include <netinet/in.h> |
32 |
# include <sys/socket.h> |
|
|
33 |
# include <netinet/in.h> |
| 34 |
#endif |
| 27 |
|
35 |
|
| 28 |
// ns3 includes |
36 |
// ns3 includes |
| 29 |
#include "ns3/animation-interface.h" |
37 |
#include "ns3/animation-interface.h" |
|
|
| 58 |
|
66 |
|
| 59 |
bool AnimationInterface::SetServerPort (uint16_t port) |
67 |
bool AnimationInterface::SetServerPort (uint16_t port) |
| 60 |
{ |
68 |
{ |
|
|
69 |
#if (!(defined(HAVE_SYS_SOCKET_H)) || !(defined(HAVE_NETINET_IN_H))) |
| 61 |
int s = socket (AF_INET, SOCK_STREAM, 0); |
70 |
int s = socket (AF_INET, SOCK_STREAM, 0); |
| 62 |
struct sockaddr_in addr; |
71 |
struct sockaddr_in addr; |
| 63 |
addr.sin_family = AF_INET; |
72 |
addr.sin_family = AF_INET; |
|
|
| 77 |
int t = 1; |
86 |
int t = 1; |
| 78 |
setsockopt (s, SOL_SOCKET, SO_LINGER, &t, sizeof(t)); |
87 |
setsockopt (s, SOL_SOCKET, SO_LINGER, &t, sizeof(t)); |
| 79 |
return true; |
88 |
return true; |
|
|
89 |
#endif |
| 90 |
return false;//never reached unless the above is disabled |
| 80 |
} |
91 |
} |
| 81 |
|
92 |
|
| 82 |
bool AnimationInterface::SetInternalAnimation () |
93 |
bool AnimationInterface::SetInternalAnimation () |