Altera_Forum
Honored Contributor
16 years agoNicheStack Wont Connect to Server
Hello everyone,
I'm trying to set up some TCP communications between a PC and this DE2-115 board. When I fire up the system I get this: --- Quote Start --- InterNiche Portable TCP/IP, v3.1 Copyright 1996-2008 by InterNiche Technologies. All rights reserved. prep_tse_mac 0 MAC Address is: 0:7:ED:FF:CD:F DHCP Enabled. prepped 1 interface, initializing... [tse_mac_init] INFO : TSE MAC 0 found at address 0x06002000 INFO : PHY Marvell 88E1111 found at PHY address 0x10 of MAC Group[0] INFO : PHY[0.0] - Automatically mapped to tse_mac_device[0] INFO : PHY[0.0] - Restart Auto-Negotiation, checking PHY link... INFO : PHY[0.0] - Auto-Negotiation PASSED INFO : PHY[0.0] - Checking link... INFO : PHY[0.0] - Link established INFO : PHY[0.0] - Speed = 100, Duplex = Full OK, x=0, CMD_CONFIG=0x00000000 MAC post-initialization: CMD_CONFIG=0x04000203 [tse_sgdma_read_init] RX descriptor chain desc (1 depth) created mctest init called IP address of et1 : 204.177.5.2 Created "Inet main" task (Prio: 2) Created "clock tick" task (Prio: 3) Acquired IP address via DHCP client for interface: et1 IP address : 192.168.2.193 Subnet Mask: 255.255.255.0 Gateway : 192.168.2.1 Attempting to Connect to Target Server at 192.168.2.129 on Port: 502 Returned 8500446 as socket. Error Connecting To Server. Error: Connect Subroutine Has Failed. --- Quote End --- The function that does the networking bits is here...I have a server listening on that IP address at that specific port... --- Quote Start --- int sd,i; struct sockaddr_in server; //Zero out structure bzero(&server, sizeof(server)); //Obtain Socket For Connection if((sd=socket(AF_INET,SOCK_STREAM,0))<0){ printf("Error Obtaining Socket"); printf("Error: ", strerror(errno)); return -1; } else{ printf("Returned %d as socket.\n",sd); //Set Connection Details server.sin_family=AF_INET; server.sin_port = htons(port); inet_pton(AF_INET,"192.168.2.129", server.sin_addr.s_addr); //Connects if(connect(sd,server.sin_addr.s_addr,sizeof(server))<0){ printf("Error Connecting To Server.\n"); printf("Error: %s", strerror(errno)); return -1; } else{ return sd; } //Shouldn't have gotten down here, so error out anyway. return -1; --- Quote End --- Does anyone have any pointers/tips/comments... I'd appreciate it very much.. Thanks -Kris