Index: trunk/lib/FlairCore/src/UdpSocket.cpp
===================================================================
--- trunk/lib/FlairCore/src/UdpSocket.cpp	(revision 362)
+++ trunk/lib/FlairCore/src/UdpSocket.cpp	(revision 363)
@@ -39,6 +39,6 @@
 UdpSocket::~UdpSocket() { delete pimpl_; }
 
-void UdpSocket::SendMessage(const char *message, size_t message_len) {
-  pimpl_->SendMessage(message, message_len);
+void UdpSocket::SendMessage(const char *message, size_t message_len,int dst_id) {
+  pimpl_->SendMessage(message, message_len,dst_id);
 }
 
@@ -46,6 +46,6 @@
 
 ssize_t UdpSocket::RecvMessage(char *buf, size_t buf_len, Time timeout, char *src,
-                            size_t *src_len) {
-  return pimpl_->RecvMessage(buf, buf_len, timeout, src, src_len);
+                            size_t *src_len,int *src_id) {
+  return pimpl_->RecvMessage(buf, buf_len, timeout, src, src_len,src_id);
 }
 
Index: trunk/lib/FlairCore/src/UdpSocket.h
===================================================================
--- trunk/lib/FlairCore/src/UdpSocket.h	(revision 362)
+++ trunk/lib/FlairCore/src/UdpSocket.h	(revision 363)
@@ -14,6 +14,4 @@
 #define UDPSOCKET_H
 
-#include <unistd.h>
-#include <stdint.h>
 #include <Object.h>
 
@@ -76,6 +74,7 @@
   * \param message message
   * \param message_len message length
+  * \param dst_id id of the dst if multiple connection (quick and dirty hack for sido, only works on NRT)
   */
-  void SendMessage(const char *message, size_t message_len);
+  void SendMessage(const char *message, size_t message_len,int dst_id=0);
 
   /*!
@@ -84,5 +83,5 @@
   * Receive a message and wait up to timeout. \n
   * If src and src_len are specified, the source of the message will be
-  * copied in the src buffer. \n
+  * copied in the src buffer. Source is the Flair name of sender\n
   * Note that in case of a broadcast socket, own messages are filtered and
   * are not received.
@@ -93,9 +92,10 @@
   * \param src buffer to put source name
   * \param src_len buffer length
+  * \param src_id id of the src, to be used for sending if multiple connection (quick and dirty hack for sido, only works on NRT)
   *
   * \return size of the received message
   */
   ssize_t RecvMessage(char *buf, size_t buf_len, Time timeout, char *src = NULL,
-                      size_t *src_len = NULL);
+                      size_t *src_len = NULL,int *src_id=NULL);
 
   void NetworkToHost(char *data, size_t dataSize);
Index: trunk/lib/FlairCore/src/UdpSocket_impl.cpp
===================================================================
--- trunk/lib/FlairCore/src/UdpSocket_impl.cpp	(revision 362)
+++ trunk/lib/FlairCore/src/UdpSocket_impl.cpp	(revision 363)
@@ -53,4 +53,6 @@
 void UdpSocket_impl::Init(void) {
   int yes = 1;
+  sock_in_size=0;
+  sock_in=NULL;
 
   fd = socket(AF_INET, SOCK_DGRAM, 0); // UDP
@@ -136,8 +138,9 @@
       self->Err("gethostbyname\n");
     }
-
-    sock_in.sin_addr = *(in_addr *)hostinfo->h_addr;
-    sock_in.sin_port = htons(port);
-    sock_in.sin_family = AF_INET;
+    sock_in=(struct sockaddr_in*)malloc(sizeof(struct sockaddr_in));
+    sock_in[0].sin_addr = *(in_addr *)hostinfo->h_addr;
+    sock_in[0].sin_port = htons(port);
+    sock_in[0].sin_family = AF_INET;
+    sock_in_size++;
   }
 }
@@ -155,34 +158,34 @@
 #endif
   close(fd);
-}
-
-void UdpSocket_impl::SendMessage(const char *src, size_t src_len) {
+  free(sock_in);
+}
+
+void UdpSocket_impl::SendMessage(const char *msg, size_t msg_len,int dst_id) {
   ssize_t written;
   string to_send;
 	
   if (broadcast == true) {
-    to_send = getFrameworkManager()->ObjectName() + ":" + string(src, src_len);
-    src_len = to_send.size();
-    src = (char *)to_send.c_str();
+    to_send = getFrameworkManager()->ObjectName() + ":" + string(msg, msg_len);
+    msg_len = to_send.size();
+    msg = (char *)to_send.c_str();
   }
 
 #ifdef __XENO__
   // Printf("send pipe %s\n",src);
-  written = rt_pipe_write(&pipe, src, src_len, P_NORMAL);
+  written = rt_pipe_write(&pipe, msg, msg_len, P_NORMAL);
 
   if (written < 0) {
     char errorMsg[256];
     self->Err("rt_pipe_write error (%s)\n", strerror_r(-written, errorMsg, sizeof(errorMsg)));
-  } else if (written != (ssize_t)src_len) {
+  } else if (written != (ssize_t)msg_len) {
     self->Err("rt_pipe_write error %i/%i\n", written, to_send.size());
   }
 #else
-  written =
-      sendto(fd, src, src_len, 0, (struct sockaddr *)&sock_in, sizeof(sock_in));
+  written = sendto(fd, msg, msg_len, 0, (struct sockaddr *)&(sock_in[dst_id]), sizeof(struct sockaddr_in));
   if(written==-1) {
 		char errorMsg[256];
     self->Err("sendto error (%s)\n",strerror_r(errno, errorMsg, sizeof(errorMsg)));
-  } else if (written != (ssize_t)src_len) {
-    self->Err("sendto error %i/%i\n",written,src_len);
+  } else if (written != (ssize_t)msg_len) {
+    self->Err("sendto error %i/%i\n",written,msg_len);
   }
 #endif
@@ -205,6 +208,5 @@
   }
 #else
-  written = sendto(fd, message.c_str(), message.size(), 0,
-                   (struct sockaddr *)&sock_in, sizeof(sock_in));
+  written = sendto(fd, message.c_str(), message.size(), 0, (struct sockaddr *)&sock_in, sizeof(struct sockaddr_in));
   if (written != (ssize_t)message.size()) {
     self->Err("sendto error\n");
@@ -215,5 +217,5 @@
 
 ssize_t UdpSocket_impl::RecvMessage(char *msg, size_t msg_len, Time timeout,
-                                 char *src, size_t *src_len) {
+                                 char *src, size_t *src_len,int* src_id) {
   ssize_t nb_read;
   char buffer[128];
@@ -221,8 +223,7 @@
   nb_read = rt_pipe_read(&pipe, &buffer, sizeof(buffer), timeout);
 #else
-  socklen_t sinsize = sizeof(sock_in);
-  struct timeval tv;
 
   if (timeout != TIME_NONBLOCK) {
+    struct timeval tv;
     int attr = fcntl(fd, F_GETFL, 0);
     fcntl(fd, F_SETFL, attr & (~O_NONBLOCK));
@@ -238,9 +239,28 @@
   }
 
+  struct sockaddr_in sock_in_tmp;
   if (broadcast == false) {
-    nb_read =
-        recvfrom(fd, buffer, sizeof(buffer), 0, (sockaddr *)&sock_in, &sinsize);
+    socklen_t sinsize = sizeof(struct sockaddr_in);
+    nb_read = recvfrom(fd, buffer, sizeof(buffer), 0, (sockaddr *)&sock_in_tmp, &sinsize);
   } else {
     nb_read = recvfrom(fd, buffer, sizeof(buffer), 0, NULL, NULL);
+  }
+  
+  if(broadcast==false && nb_read>0) {
+    int i;
+    for(i=0;i<sock_in_size;i++) {
+        if(sock_in[i].sin_port==sock_in_tmp.sin_port) {
+            Printf("match found in former adress\n");
+            *src_id=i;
+            break;
+        }
+    }
+    if(i==sock_in_size) {
+        Printf("no match found in former adress\n");
+        sock_in_size++;
+        sock_in=(sockaddr_in*)realloc(sock_in,sock_in_size*sizeof(sockaddr_in));
+        sock_in[sock_in_size-1]=sock_in_tmp;
+        *src_id=sock_in_size-1;
+    }
   }
 #endif
@@ -266,8 +286,6 @@
           return -1;
         }
-      } else if (nb_read - index - 1 + 1 >
-                 (int)msg_len) { //+1 pour inserer un 0
-        self->Warn("insufficent msg size (%i/%i)\n", nb_read - index - 1 + 1,
-                   msg_len);
+      } else if (nb_read - index - 1 + 1 > (int)msg_len) { //+1 pour inserer un 0
+        self->Warn("insufficent msg size (%i/%i)\n", nb_read - index - 1 + 1, msg_len);
         return -1;
       }
@@ -329,5 +347,5 @@
 
       if (FD_ISSET(caller->fd, &set)) {
-        socklen_t sinsize = sizeof(caller->sock_in);
+        socklen_t sinsize = sizeof(struct sockaddr_in);
         if (caller->broadcast == false) {
           nb_read = recvfrom(caller->fd, buffer, sizeof(buffer), 0,
@@ -361,5 +379,5 @@
           nb_write = sendto(caller->fd, buffer, nb_read, 0,
                             (struct sockaddr *)&(caller->sock_in),
-                            sizeof(caller->sock_in));
+                            sizeof(struct sockaddr_in));
           if (nb_write != nb_read) {
             caller->self->Err("sendto error\n");
Index: trunk/lib/FlairCore/src/unexported/UdpSocket_impl.h
===================================================================
--- trunk/lib/FlairCore/src/unexported/UdpSocket_impl.h	(revision 362)
+++ trunk/lib/FlairCore/src/unexported/UdpSocket_impl.h	(revision 363)
@@ -33,7 +33,7 @@
 
   void SendMessage(std::string message);
-  void SendMessage(const char *src, size_t src_len);
+  void SendMessage(const char *msg, size_t msg_len,int dst_id);
   ssize_t RecvMessage(char *msg, size_t msg_len, flair::core::Time timeout,
-                      char *src = NULL, size_t *src_len = NULL);
+                      char *src = NULL, size_t *src_len = NULL,int *src_id=NULL);
 
 private:
@@ -44,5 +44,6 @@
   void Init(void);
   const flair::core::UdpSocket *self;
-  struct sockaddr_in sock_in;
+  struct sockaddr_in *sock_in;
+  size_t sock_in_size;
 #ifdef __XENO__
   bool is_running;
