Kyle Ludwig

MC52233 client using minisockets

Discussion created by Kyle Ludwig on Oct 24, 2006
Latest reply on Nov 7, 2006 by Kyle Ludwig
Hi there

I have been trying to implement a simple tcp session between my PC and the 52233Demo board. The trouble I am having has been with the m_connect and m_send socket functions. All I want to do is open a socket, send one character via TCP and then close the socket. My code is as follows:

M_SOCK sockfd;
struct sockaddr_in dest_addr; // will hold the destination addr
char stuff='f';
int nb_bl=0;

sockfd = m_socket(); // do some error checking
//m_ioctl(sockfd,SO_NBIO ,&nb_bl);

dest_addr.sin_family = AF_INET;
dest_addr.sin_port = 3490;
dest_addr.sin_addr.s_addr = inet_addr("" );
memset(&(dest_addr.sin_zero), '\0', 8);

m_connect(sockfd, &dest_addr, something);



When I run the code on the coldfire the following happens:
mc52233 sends out an ARP request
Pc replies witht its mac address
mc5233 sends out TCP syn request
PC replies with RST ACK
and then no more packets are sent and the mc52233 continues runnig other tasks.

It seems that the connect fucntion is working but not the send.
I think this may have something to do with my callback function: something
at the moment it does nothing cause I'm not to sure how to use this. However the socket should be by default set to blocking so the callback function should not be needed...

Can anyone point out what I am doing wrong. Please speak slowly as I am new to sockets and TCP/IP :smileyhappy: