RE: tcp/ip sockets in apache module

2014-06-17 Thread Tim McCracken

I have a module that does this in Windows. I used code right off the MSDN site 
for a TCP/IP client.

Did you remember to do wsastartup?



-Original Message-
From: Jeff Trawick [mailto:traw...@gmail.com] 
Sent: Friday, May 23, 2014 1:14 PM
To: modules-dev@httpd.apache.org
Subject: Re: tcp/ip sockets in apache module

On Fri, May 23, 2014 at 1:58 PM, Jeremy Thompson jer...@warehousesports.com
 wrote:

 I'Ll give that a shot.  I'Ve used source level debugging in IDE's but 
 it looks like I'Ll be using GDB for this one. Thanks.


Have a look at

http://httpd.apache.org/dev/debugging.html

On Windows, you can start httpd normally and attach to the httpd child process 
from the Visual Studio IDE in order to debug.







 On 5/23/14 10:41 , Jeff Trawick traw...@gmail.com wrote:

 On Fri, May 23, 2014 at 1:27 PM, Jeremy Thompson 
 jer...@warehousesports.com
  wrote:
 
  I'm trying to write a module for apache.  I've successfully compile 
 in a  test module that doesn't do a whole lot yet.  I would like to 
 be able to  use  tcp/ip sockets in the module to talk to another 
 server.  I added in some  test code that should connect to my 
 listening server and say hello whenever  a request is made.  I'm not 
 getting any errors upon compiling the module  with the sockets stuff 
 added but its not actually doing anything.
   Basically
  its ignoring my connect and send code.  Does anyone have a small 
 working  example of this or am I just way off base in using TCP/IP 
 for external  communication to a module.  Thanks.
 
  ~Jeremy
 
 
 You need to know how to step through your code with a source level 
 debugger so you can figure out these sorts of problems on your own.
 
 Do you know how to do that?  Are you trying but it isn't stopping in 
 your code?  Is there some other issue with source level debugging?
 
 --
 Born in Roswell... married an alien...
 http://emptyhammock.com/
 http://edjective.org/






--
Born in Roswell... married an alien...
http://emptyhammock.com/
http://edjective.org/


Re: tcp/ip sockets in apache module

2014-05-24 Thread Alex Bligh

On 23 May 2014, at 18:27, Jeremy Thompson wrote:

 I'm trying to write a module for apache.  I've successfully compile in a
 test module that doesn't do a whole lot yet.  I would like to be able to use
 tcp/ip sockets in the module to talk to another server.  I added in some
 test code that should connect to my listening server and say hello whenever
 a request is made.  I'm not getting any errors upon compiling the module
 with the sockets stuff added but its not actually doing anything.  Basically
 its ignoring my connect and send code.  Does anyone have a small working
 example of this or am I just way off base in using TCP/IP for external
 communication to a module.  Thanks.


Not that small, but:
  https://github.com/abligh/apache-websocket

-- 
Alex Bligh






Re: tcp/ip sockets in apache module

2014-05-23 Thread Jeff Trawick
On Fri, May 23, 2014 at 1:27 PM, Jeremy Thompson jer...@warehousesports.com
 wrote:

 I'm trying to write a module for apache.  I've successfully compile in a
 test module that doesn't do a whole lot yet.  I would like to be able to
 use
 tcp/ip sockets in the module to talk to another server.  I added in some
 test code that should connect to my listening server and say hello whenever
 a request is made.  I'm not getting any errors upon compiling the module
 with the sockets stuff added but its not actually doing anything.
  Basically
 its ignoring my connect and send code.  Does anyone have a small working
 example of this or am I just way off base in using TCP/IP for external
 communication to a module.  Thanks.

 ~Jeremy


You need to know how to step through your code with a source level debugger
so you can figure out these sorts of problems on your own.

Do you know how to do that?  Are you trying but it isn't stopping in your
code?  Is there some other issue with source level debugging?

-- 
Born in Roswell... married an alien...
http://emptyhammock.com/
http://edjective.org/


Re: tcp/ip sockets in apache module

2014-05-23 Thread Jeff Trawick
On Fri, May 23, 2014 at 1:58 PM, Jeremy Thompson jer...@warehousesports.com
 wrote:

 I'Ll give that a shot.  I'Ve used source level debugging in IDE's but it
 looks like I'Ll be using GDB for this one. Thanks.


Have a look at

http://httpd.apache.org/dev/debugging.html

On Windows, you can start httpd normally and attach to the httpd child
process from the Visual Studio IDE in order to debug.







 On 5/23/14 10:41 , Jeff Trawick traw...@gmail.com wrote:

 On Fri, May 23, 2014 at 1:27 PM, Jeremy Thompson
 jer...@warehousesports.com
  wrote:
 
  I'm trying to write a module for apache.  I've successfully compile in a
  test module that doesn't do a whole lot yet.  I would like to be able to
  use
  tcp/ip sockets in the module to talk to another server.  I added in some
  test code that should connect to my listening server and say hello
 whenever
  a request is made.  I'm not getting any errors upon compiling the module
  with the sockets stuff added but its not actually doing anything.
   Basically
  its ignoring my connect and send code.  Does anyone have a small working
  example of this or am I just way off base in using TCP/IP for external
  communication to a module.  Thanks.
 
  ~Jeremy
 
 
 You need to know how to step through your code with a source level
 debugger
 so you can figure out these sorts of problems on your own.
 
 Do you know how to do that?  Are you trying but it isn't stopping in your
 code?  Is there some other issue with source level debugging?
 
 --
 Born in Roswell... married an alien...
 http://emptyhammock.com/
 http://edjective.org/






-- 
Born in Roswell... married an alien...
http://emptyhammock.com/
http://edjective.org/


RE: [EXTERNAL] Re: tcp/ip sockets in apache module

2014-05-23 Thread Nebergall, Christopher
Also since there is no reason AFAIK that what you are attempting shouldn't work 
in your debugging make extra sure that the apache hook you are using is 
actually being called in your test requests, and that understand the order that 
hooks are called in - for example if set up the socket in one hook then expect 
to use in another - make sure that the socket isn't NULL or worse set to a 
random memory value in the second call.Also you can use a lot of 
ap_log_rerror entries in your code to help in debugging.

http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__LOG.html#ga7b7009cfaad5a84be316e523d7ef1236

-Topher
-Original Message-
From: Jeff Trawick [mailto:traw...@gmail.com] 
Sent: Friday, May 23, 2014 1:14 PM
To: modules-dev@httpd.apache.org
Subject: [EXTERNAL] Re: tcp/ip sockets in apache module

On Fri, May 23, 2014 at 1:58 PM, Jeremy Thompson jer...@warehousesports.com
 wrote:

 I'Ll give that a shot.  I'Ve used source level debugging in IDE's but it
 looks like I'Ll be using GDB for this one. Thanks.


Have a look at

http://httpd.apache.org/dev/debugging.html

On Windows, you can start httpd normally and attach to the httpd child
process from the Visual Studio IDE in order to debug.







 On 5/23/14 10:41 , Jeff Trawick traw...@gmail.com wrote:

 On Fri, May 23, 2014 at 1:27 PM, Jeremy Thompson
 jer...@warehousesports.com
  wrote:
 
  I'm trying to write a module for apache.  I've successfully compile in a
  test module that doesn't do a whole lot yet.  I would like to be able to
  use
  tcp/ip sockets in the module to talk to another server.  I added in some
  test code that should connect to my listening server and say hello
 whenever
  a request is made.  I'm not getting any errors upon compiling the module
  with the sockets stuff added but its not actually doing anything.
   Basically
  its ignoring my connect and send code.  Does anyone have a small working
  example of this or am I just way off base in using TCP/IP for external
  communication to a module.  Thanks.
 
  ~Jeremy
 
 
 You need to know how to step through your code with a source level
 debugger
 so you can figure out these sorts of problems on your own.
 
 Do you know how to do that?  Are you trying but it isn't stopping in your
 code?  Is there some other issue with source level debugging?
 
 --
 Born in Roswell... married an alien...
 http://emptyhammock.com/
 http://edjective.org/






-- 
Born in Roswell... married an alien...
http://emptyhammock.com/
http://edjective.org/


Re: tcp/ip sockets in apache module

2014-05-23 Thread Nick Kew
On Fri, 2014-05-23 at 10:27 -0700, Jeremy Thompson wrote:
 I'm trying to write a module for apache.  I've successfully compile in a
 test module that doesn't do a whole lot yet.  I would like to be able to use
 tcp/ip sockets in the module to talk to another server.

This may or may not make sense in your application,
but have you considered using the proxy framework?
That might involve a mod_proxy_yourprotocol to handle
the tcp requirements.  Your main module would then
create a proxy subrequest when it needs a connection.

See mod_include for an example, where
!--#include virtual ... uses a proxy subrequest to
make an HTTP connection.

-- 
Nick Kew