Jump to content

newbie...but dangerous


cpanon

Recommended Posts

Hello

I have an odd need, that hopefully one of you great gurus can help, grin.

 

I need to a process on the server listening for a particular port.  Grab the response and forward it on to a servlet.  I know enough to be dangerous to ass-ume.  I have done a little php.  I need help on these points:

1.  How do I start a process/script for just listening on the server and loop it forever?

2.  How do I format the response and forward it to a servlet?

tia.

Link to comment
Share on other sites

basically what he said, except it should be a cron job, that way it will be forked and won't consume all of your processor speed. 

 

and to listen for a port you are going to need to use the php socket functions, I suppose you know somthing about sockets and the like...

 

http://www.php.net/manual/en/ref.sockets.php

heres some reference for php sockets

 

I'm not sure exactly what you are trying to do, so I really cant give you any example source.

 

loop forever

1 . have it listen for an incoming connection

2 . If you get an incoming connection create your connection to the servlet and send whatever you need to send.

 

I hope my incoherent ramblings help

 

 

Link to comment
Share on other sites

Hi

Thanks.  However I will be running this on Apache 2 on win32 and I dont think I can get cgywin up.  Is there an efficient way of doing rather than just posting the page and letting it run?

 

So it sounds like I will need to use sockets and cURL? 

 

My project is "in the lab" state right now.  My competence is with servlets/struts.  I am talking to a cc processor at the api level.  I have allot of code already in servlet and I want to reuse it.  So I am thinking about pre-processing the data with an action, sending it to the processor.  This is next is where the php comes in.  Have a php script running on one of the virtual host in my apache setup just listening for the response, capture the response and forward it to my post-processing servlet, release and repeat.  Of course in theory it will work fine, now how to do it in reality.  Any help of the php piece would be greatly appreciated. 

Link to comment
Share on other sites

link=topic=135007.msg568771#msg568771 date=1175976896]

hehe ;D i have no idea what "aggregators" means

 

Definitions of  aggregators on the Web:

 

    * Aggregators, such as NewsGator and AmphetaDesk , allow users to subscribe to feeds from sources as diverse as the BBC, Sci-Fi Today, Slashdot and thousands of bloggers across the world. The services work by checking an Internet address at a regular interval, usually once an hour, to see if new content has been added. ...

 

lol doesn't really fit huh?

 

I know aggregate is like a total or sum of objects in a sense or a group. That fits better =)

Link to comment
Share on other sites

Hi

I was using it in the context of developers.  No one is writing LALR parsers anymore.  And it is consistent with the high level description you provided.  Hey we are all just rearranging electrons at the expense of energy which of course is..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.