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);




On Mon, Sep 12, 2011 at 6:34 AM, Alan M. Carroll <
a...@network-geographics.com> wrote:

> Are you setting the port in the sockaddr? Note that in a sockaddr, all data
> is in network order (including the port).
>
> Sunday, September 11, 2011, 11:24:25 AM, you wrote:
>
> > Dear All,
>
> > I am tring to run a plugin example: server-transform.c under V3.0.0. But
> I
> > found that it does not work out of the box. Firstly, it cannot be
> compiled
> > properly due to TSNetConnect(contp, server_ip, server_port);
>
> > In V3.0.0, the parameter of this function has been changed to
> > TSNetConnect(TSCont contp, sockaddr const* addr);
>
> > I have tried to change to the new function. However, it does not work
> > properly. This transform plugin actually sends received buffer to a local
> > socket server (echo server), which will send the content back to the
> plugin.
> > I found that even TSNetConnect() returns SUCCESS, but it does not send
> > anything out to the socket server. I have tried to use TCPdump to capture
> > packets with port = 7 (echo port). BUt I did not captured any such
> packets.
> > It looks like TSNetConnect() has some problems. Many thanks for any help.
>
> > Rgds,
> > Steve
>
>

Reply via email to