Re: problem for plugin example: server-transform.c

2011-09-12 Thread steven liu
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. tcp0 0 0.0.0.0:55660.0.0.0:* LISTEN It looks quite strange. TCPDump canno

Re: problem for plugin example: server-transform.c

2011-09-12 Thread Alan M. Carroll
Monday, September 12, 2011, 10:28:17 AM, you wrote: > The server port comes from a URL, e.g. http://10.44.10.1:80, and I just atoi > the port. I have checked with a network trace that the correct port is being > connected to. With previous versions of Traffic Server I never had to > use ntohs and

Re: problem for plugin example: server-transform.c

2011-09-12 Thread Chris Reynolds
The server port comes from a URL, e.g. http://10.44.10.1:80, and I just atoi the port. I have checked with a network trace that the correct port is being connected to. With previous versions of Traffic Server I never had to use ntohs and just passed in the atoied number. On 12 September 2011 15:57

Re: problem for plugin example: server-transform.c

2011-09-12 Thread Alan M. Carroll
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

Re: problem for plugin example: server-transform.c

2011-09-12 Thread Chris Reynolds
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 wrote: > Thanks. Yes. I am setting port using hons() using following codes. > > struct sockaddr_in ip4addr; > ip4addr.sin_family = AF_INET; > ip4addr.s

Re: problem for plugin example: server-transform.c

2011-09-11 Thread steven liu
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);

Re: problem for plugin example: server-transform.c

2011-09-11 Thread Alan M. Carroll
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

problem for plugin example: server-transform.c

2011-09-11 Thread steven liu
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(T