Hello All! I can send TCP Packet from BBB from console: echo " 11111" > /dev/tcp/81.23.XX.XX/5555 And it is working correct. When I try to send TCP from c++ application, I can't connect to server( Timeout error). Eth scheem: BBB(192.168.1.7 -> MyRouter(static IP) -> ... -> ... -> ServerRouter(81.23.XX.XX) -> Server(192.168.4.55) My PC(192.168.1.2) -> MyRouter But if I run server software in my PC, TPC packets from BBB to My PC works. Why? BBTcpErrorCode BBTCPClient::connectToServer(string serverIpAddr, int serverPort) { //создаем сокет LOG("Create socket..."); if ((m_socket = socket(PF_INET, SOCK_STREAM, 0)) < 0) { return BBTCP_SOCKETERROR; } LOG("Socket created!");
/* Обнуляем переменную m_addr и забиваем её нужными значениями */ bzero(&m_addr, sizeof(m_addr)); m_addr.sin_family = AF_INET; // обязательно AF_INET! m_addr.sin_port = htons(serverPort); // 0 - выдать порт автоматом /* Переводим адрес в нужный нам формат */ if (inet_aton(m_IpAddr.c_str(), &m_addr.sin_addr) == 0) { LOG_INT("Error assign IP ADDR!", errno); return BBTCP_ADDRERROR; } const int on = 1; setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, &on, sizeof on); /* Биндим сокет */ if (bind(m_socket, (struct sockaddr*) &m_addr, sizeof(m_addr)) < 0) { LOG_INT("Error bind socket!", errno); return BBTCP_BINDERROR; } /* Обнуляем переменную s_addr и забиваем её нужными значениями */ bzero(&s_addr, sizeof(s_addr)); s_addr.sin_family = AF_INET; s_addr.sin_port = htons(serverPort); /* Переводим адрес в нужный нам формат */ if (inet_aton(serverIpAddr.c_str(), &s_addr.sin_addr) == 0) { return BBTCP_ADDRERROR; } if (connect(m_socket, (struct sockaddr*) &s_addr, sizeof(s_addr)) < 0) { return BBTCP_CONNECTERROR; // <- When I try to send to 82.XX.XX.XX this error arise after ~ 1 minute ( errno = 101 -- timeout ) } return BBTCP_OK; } -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.