Re: newbie:changing variable to type resource

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard,

Thanks for the quick reply.

Here is what I am trying to do :

I am trying to tunnel some http packets from the browser to a PC which
is inside a private network/firewall.

The PC in the pvt. netwok sends a request to my server at regular interval.
When the browser wants to send some packets to the PC (which it can't
without opening a port in the firewall), it sends the packets to my
program  and my program tunnels those packets in the response to the
request messeges coming from the PC inside the firewall.

I am able to do it when there is only one PC and one browser tries to
access it by storing the socket ID of the browser connection in a
temporary variable in my program ,but I need  some kind of mechanism
to store socket IDs for connections coming from multiple browsers.
Without which I can't distinguish between different connections.

Regards,
-Saswat


On Mon, 14 Mar 2005 09:11:46 -0800 (PST), Richard Lynch <ceo@xxxxxxxxx> wrote:
> > I am new to PHP, stuck with a problem and need your help.
> >
> > I would like to change a variable to type resource.
> > I searched in php.net and in google but did not find anything helpful.
> >
> > Now , why I would like to do that...
> >
> > I am writing a socket application which will accept connection from
> > browser,receive data and write the data sent by browser into another
> > open socket.Receive data from the open socket and write it back to the
> > browser.
> >
> > When there are more than one client(browser) connecting to my program
> > ,I am saving the connection information (socket ID)for browser
> > connections in a plain text file.
> >
> > I intend to retrive the socket ID information and do a
> > socket_write(..) with socket ID as the first parameter, but I am
> > getting an error that I cant convert any type to a resource type. Is
> > there any workaround ??
> >
> > Is it going to help me if I use session information ?
> >
> > I am not using apache.
> >
> > I may be wrongly designing the program.
>
> The design just maybe might be fine in theory, but in practice...
>
> A socket connection can't be shared across PHP instances, I don't think.
>
> Certainly not by writing the resource into a text file.
>
> You *MIGHT* be able to write the resource into shared memory
> http://php.net/shmop but I doubt that will work at all, and even if it
> does, having two programs reading/writing the same socket resource at one
> time sounds like a recipie for disaster.
>
> Why do you want to share this socket across two PHP programs?
>
> What exactly are you doing?
>
> I suspect that the design is not right, even in theory, but can't be sure.
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux