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 :
- Connect to AP using the 0c8godzilla8test1234 command and wait for IP address to be assigned
- Open socket using the 03 command
- connect to socket using the command 0d020015a2fcf35f
- 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.