Quantcast
Channel: Wireless Connectivity
Viewing all articles
Browse latest Browse all 116964

Forum Post: RE: Unreliable wlan_connect()

$
0
0

Hi,

Please see an example of how to open and connect to a tcp socket.

sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);

dest_addr.sa_family = AF_INET;

// The destination port
dest_addr.sa_data[0] = 0xEB;
dest_addr.sa_data[1] = 0x14;//60180
// IP address to connect to
dest_addr.sa_data[2] = 192;
dest_addr.sa_data[3] = 168;
dest_addr.sa_data[4] = 0;
dest_addr.sa_data[5] = 108;

connect(sockfd, &dest_addr, sizeof(dest_addr));

where:

unsigned long sockfd

sockaddr dest_addr;

and then:

bytes_tx = send(sockfd, &SendBuf[0], MAX_TCP_PAYLOAD_SIZE, 0);
where:

unsigned char SendBuf[MAX_TCP_PAYLOAD_SIZE]; 


Viewing all articles
Browse latest Browse all 116964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>