[VxW] Re: socket/connect/send

Johnny Willemsen jwillemsen at remedy.nl
Tue Aug 26 21:20:04 PDT 2003


Hi,

If you can upgrade to VxWorks 5.5 I would recommand to use ACE
(www.cs.wustl.edu/~schmidt) for these kinds of things. Books are available
(see site) and hides you from all these horrible C-calls. VxWorks 5.4 is not
supported by ACE.

Regards,

Johnny

"Fenster" <fenster at croctec.co.uk> wrote in message
news:CqnO8XBTK0S$EwXk at FensterPC.croctec.co.uk...
>
> I'm relatively new to VxWorks and I'm trying to get my first ethernet
> connection together (in a VxWorks application) but I've got problems,
> can anyone give some pointers?
>
> I've coded up the following (based on the tcpClient.c example from
> VxWorks Network Programmer's Guide 5.4 except that I've used send()
> rather than write()).
>
> struct sockaddr_in serverAddr;
>
> serverAddr.sin_family       = AF_INET;
> serverAddr.sin_len          = sizeof(struct sockaddr_in);
> serverAddr.sin_port         = htons(0xDEAD);
> serverAddr.sin_addr.s_addr  = inet_addr("10.0.0.55");
>
> int fdFCC = socket(AF_INET, SOCK_STREAM, 0);
> if (ERROR != fdFCC)
>     {
>     if (OK == connect(fdFCC, &serverAddr, sizeof(struct sockaddr_in)))
>         {
>         char szMessage[25] = "Hello world\r\n";
>         send(fdFCC, szMessage, strlen(szMessage), 0);
>         }
>     }
>
> This builds on a PC as well as VxWorks 5.4.
>
> I have a PC-based server that displays data coming in on port 57005.
>
> The PC version of the above runs as expected, the server displays "Hello
> world", the VxWorks version doesn't.  If I check the returns the socket
> is being created/opened, the connection is being made and send() returns
> the correct number of characters but the server sees nothing.
>
> If I do a looped send() it works for a few minutes and then fails, as if
> the connection has been broken by the server or something.
>
> Any help or (polite) suggestions would be greatly appreciated.
>
> Cheers.
>
> --
> Fenster




More information about the VxWexplo mailing list