This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

issue with TCP Connect() command

Other Parts Discussed in Thread: MSP430G2553

Hi,

I've been attempting to create a connection between the CC3000 and a server running ubuntu with an
IP address: 162.252.243.95. I'm using a MSP430G2553 to interface this with a slightly modified version of the basic wifi application, whose code base can be found here.. I'm trying to connect to port 21 of the server as I intend to create an FTP application. I have checked to make sure that FTP with the server works from several other devices as well as checking that port 21 is actually open as viewed externally from http://ping.eu/port-chk/.

I follow the process as detailed below with wireshark monitoring communications using the filter
ip.src == 192.168.43.103 (address assigned to the CC3000). Unfortunately, during the connect() command I see no communication on wireshark (it is my understanding that there should be some communication at this stage). as a side note, purely by accident when testing I noticed that if the destination ip address was 162.252.243.255, or in fact any ip address with the last octet of .255, there was communication picked up by wireshark.

I have made several handlers for UART input for connecting to a secured AP, using the connect () command and using send(), all changed code is below.
My process is as follows :

  1. Connect to AP using the 0c8godzilla8test1234 command and wait for IP address to be assigned
  2. Open socket using the 03 command
  3. connect to socket using the command 0d020015a2fcf35f
  4. Send Data using the command 0e05hello

I have modified the 03 Open socket command to open a TCP stream socket rather than UDP as follows

ulSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);

I have also added 3 command, 0c, 0d, and 0e to connect to a secured AP, use the connect() command, and use the send() command as follows

case UART_COMMAND_CC3000_ENCRYPTED_CONNECT:
	//Get the length of the SSID
	ulSsidLen = atoc(usBuffer[2]);
	//Point to the SSID
	DispatcherUartSendPacket(&usBuffer[3], ulSsidLen);
	pcSsid = (char *)&usBuffer[3];
	//Get the length of Pass
	ulPassLen = atoc(*(pcSsid+ulSsidLen));
	//Point to the Pass
	pcPass = (char *)(pcSsid + ulSsidLen + 1);
	wlan_connect(WLAN_SEC_WPA2, pcSsid, ulSsidLen , 0, pcPass, ulPassLen);
	break;
//Handle socket connect command case UART_COMMAND_CONNECT: //Start of Buffer pcSockAddrAscii = (char *)&usBuffer[2]; DispatcherUartSendPacket(pcSockAddrAscii, 14); // the family is always AF_INET tSocketAddr.sa_family = atoshort(pcSockAddrAscii[0], pcSockAddrAscii[1]); // the destination port tSocketAddr.sa_data[0] = ascii_to_char(pcSockAddrAscii[2], pcSockAddrAscii[3]); tSocketAddr.sa_data[1] = ascii_to_char(pcSockAddrAscii[4], pcSockAddrAscii[5]); // the destination IP address tSocketAddr.sa_data[2] = ascii_to_char(pcSockAddrAscii[6], pcSockAddrAscii[7]); tSocketAddr.sa_data[3] = ascii_to_char(pcSockAddrAscii[8], pcSockAddrAscii[9]); tSocketAddr.sa_data[4] = ascii_to_char(pcSockAddrAscii[10], pcSockAddrAscii[11]); tSocketAddr.sa_data[5] = ascii_to_char(pcSockAddrAscii[12], pcSockAddrAscii[13]); err = connect(ulSocket, &tSocketAddr, sizeof(sockaddr)); if (err < 0) DispatcherUartSendPacket("error", 5); break;
//TODO Handle Socket send command case UART_COMMAND_SEND: ulDataLength = atoshort(usBuffer[2], usBuffer[3]); pcData = (char *)&usBuffer[4]; send(ulSocket, pcData, ulDataLength, 0); break;

ISometimes I will receive the error  response and sometimes I will not (it seems at random). I tested the application using several AP's and a sample run through would look as follows :

Example App:driver version 2.13.7.15
0c8godzilla8test1234
DONE

IP:192.168.43.103
03
DONE
0d020015a2fcf35f
020015a2fcf35f

error (sometimes)

DONE

I have also hard coded the the tSocketAddr fields and had the same result as above. as a note using the command 
0d020015a2fcf3ff (.255) for the last octet shows communication on wireshark whilst still receiving the error message. The wireshark output is shown below for this command.

No. Time Source Destination Protocol Length Info
1547 526.192983000 192.168.43.103 162.252.243.255 TCP 58 1900→21 [SYN] Seq=0 Win=1460 Len=0 MSS=1460

Transmission Control Protocol, Src Port: 1900 (1900), Dst Port: 21 (21), Seq: 0, Len: 0

Is there something missing from my process or that I've overlooked in my code? Also, am I correct in assuming that I should be seeing some communication on wireshark for the connect() command? I've been attempting to debug this issue and checking posts within this forum for similar issues to no avail.

Thank you in advance for your responses, I appreciate it.

Luke.

 

  • Hi Luke,

    I could run the same test as yours, by running a TCP server on a Ubuntu PC on port 21, and it works for me! The only difference I could spot is the IP address. May be the device does not recognize the IP address and treats it to be outside the subnet.

    Can you please have your Ubuntu server acquire the IP address from the same AP using DHCP and then try the use-case? And yes, you should see a TCP SYN followed by a SYN,ACK in the air trace if the device sorts out the destination IP address and issues a connect.

    Thanks & Regards,
    Raghavendra

  • Hi Raghavendra,

    Please forgive me if I get some of the terminology wrong as I'm still new to networking, I'll try my best at explaining.

    The server is purchased in another country than I'm in, as such I don't think I'd be able to connect it to the same AP that I'm on. Should the CC3000 still be able to do a TCP connect if this is the case? And if so is there something further that I will have to add to my code? Could you please also briefly explain what you mean by treating it to be outside the subnet?

    Are you able to check if a connection to 162.252.243.95 (a2 fc f3 5f) cab be made from your application? 

    I checked tonight, and was able to see a TCP SYN on wireshark when trying to connect to another client on the same AP. I ensured the firewall was disabled and was still unable to connect to the desired IP address 162.252.243.95 unfortunately .

    Thank you very much for your response, it is much appreciated.

  • Hi Luke,

    Thanks for clarification. What I meant was, the server and client were not on the same network.

    To identify this IP address, please make sure that your AP has internet connection.

    Thanks & Regards,
    Raghavendra

  • Hi Raghavendra,

    I have connected the CC3000 device to several different AP's, all of which have internet connections. Additionally, on other devices connected to the same AP, I can ping the server 162.252.243.95 and get a response.

    Regards,

    Luke.

  • Hi all,

    I have since set up a TCP test server on my local PC connected to the same AP as the CC3000 module. The CC3000 is able to successfully connect to this server and wireshark confirms this. 

    However, when I attempt to connect to a server not connected to the same AP as the CC3000, (162.252.243.95), there are no communications seen on wireshark. Is there something additional I need to do in order to connect to servers outsisde of the AP's subnet? Or any additional steps I could take to diagnose the problem?

    I have also used a TCP client program (Hercules) to confirm that 162.252.243.95 on port 21 is actually listening, which is is. I have also confingured the CC3000 netapp_dhcp, setting all of the parameters to be 0 as follows, in order to use DHCP. Additionally,  if anyone is able to attempt to make a TCP connection  to 162.252.243.95 on port 21 using a cc3000 to confirm that it works via that it would be highly appreciated. 

    pucSubnetMask[0] = 0x0;
    		pucSubnetMask[1] = 0x0;
    		pucSubnetMask[2] = 0x0;
    		pucSubnetMask[3] = 0x0;
    
    		pucIP_Addr[0] = 0;
    		pucIP_Addr[1] = 0;
    		pucIP_Addr[2] = 0;
    		pucIP_Addr[3] = 0;
    
    		pucIP_DefaultGWAddr[0] = 0;
    		pucIP_DefaultGWAddr[1] = 0;
    		pucIP_DefaultGWAddr[2] = 0;
    		pucIP_DefaultGWAddr[3] = 0;
    
    		pucDNS[0] = 0;
    		pucDNS[1] = 0;
    		pucDNS[2] = 0;
    		pucDNS[3] = 0;
    		netapp_dhcp((unsigned long *)pucIP_Addr, (unsigned long *)pucSubnetMask, (unsigned long *)pucIP_DefaultGWAddr, (unsigned long *)pucDNS);

    Please let me know if you see any issues with this, I anticipate your replies.

    Regards,

    Luke Dolan.

  • i am working with cc3000+tm4c123gh6pm(ccs v5.5),i imported basic wifi application from tivaware package examples and  i can  see the commands on putty ,when ever i am trying to connect cc3000 with the wifi i am getting error can u please tell how i should give the ssid name

                here i gave the link of my project can u please help how to proceed with this(http://e2e.ti.com/support/wireless_connectivity/f/851/tags/http_3A002F002F00_embedded_2D00_funk-net_2F00_cc3000_2D00_basic_2D00_wifi_2D00_host_2F00_/default.aspx) and here instead of msp430 board i am using TM4C123GH6PM

    thanks in advance

  • Hi all.

    It turns out that there is an issue with viewing the communications with the server on wireshark. This is very odd as I can see communications on the same subnet to and from the CC3000 but not communications that go beyond the subnet. Unfortunately I cannot offer any solution as to why this may be occuring.

    I ran Tshark on the external linux box and was able to see the proper communication, hence verifying that the CC3000 was successful. Thank you all for your time, and if you have any input as to why the communication would not be displaying on wireshark I'd be very interested in hearing about it.

    Regards,

    Luke.