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
https://forums.phpfreaks.com/topic/46045-newbiebut-dangerous/
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
https://forums.phpfreaks.com/topic/46045-newbiebut-dangerous/#findComment-223706
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
https://forums.phpfreaks.com/topic/46045-newbiebut-dangerous/#findComment-223740
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
https://forums.phpfreaks.com/topic/46045-newbiebut-dangerous/#findComment-223767
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.