Tks. I actually tried to hard code the port number using:

ip4addr.sin_port = htons(5566);

And the following output from netstat indicates that I have a socket
listening at port 5566.

tcp        0      0 0.0.0.0:5566            0.0.0.0:*               LISTEN

It looks quite strange. TCPDump cannot capture any packet with port 5566.
And my local server listening at port 5566 also does not receive any
packets.

May I know how to run regression test for TSNetConnect()? Tks.


On Mon, Sep 12, 2011 at 10:57 PM, Alan M. Carroll <
a...@network-geographics.com> wrote:

> Actually, Chris, you should use htons since this is going from host to
> network order. However on all modern systems htons() and ntohs() are the
> same function. Some of us old timers remember systems where that wasn't the
> case but those have long since faded to memories.
>
> I think TSNetConnect gets tested during regression, so this seems a rather
> unexpected failure. From where do you get server_port? atoi and its ilk,
> hard wired constant, or some other network connection?
>
> Can you do a netstat -a -n --tcp and verify that the listening process is
> listening on the port you expect?
>
> Monday, September 12, 2011, 9:20:26 AM, you wrote:
>
> > On 3.1 I have to use the ntohs function for the port number when using
> > TsNetConnect. Have you tried this?
>
> > On 12 September 2011 02:33, steven liu <stevenli...@gmail.com> wrote:
>
> >> Thanks. Yes. I am setting port using hons() using following codes.
>
> >> struct sockaddr_in ip4addr;
> >> ip4addr.sin_family = AF_INET;
> >> ip4addr.sin_port = htons(server_port);
> >> ip4addr.sin_addr.s_addr = inet_addr((const char *)("127.0.0.1"));
> >> action = TSNetConnect(contp,  (struct sockaddr const*)&ip4addr);
>
>

Reply via email to