[PHP] Not able to connect to FTP server

2002-12-03 Thread Vinod
Hi friends,

I am having a DSL Internet connectivity in our office and my PC is
connected to Internet using a HTTP/FTP Proxy(192.168.0.10) and the
browser(Mozilla) in my PC is configured to connect to net through the
proxy

When I tried to connect to our ftp site using the following script, I
have received the message that Unable to connect.  But the same script
is working fine with a direct modem connection.

The script is 

// connect to ftp server

if(!($ftp=ftp_connect("ftp.dirw.net")))
{
print("Unable to connect");
exit;
}

Please suggest me on how to connect to the ftp site using the proxy
server.

Regards,

Vinod.B



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




[PHP] Not able to connect to FTP server

2002-12-03 Thread Vinod
Hi friends,

I am having a DSL Internet connectivity in our office and my PC is
connected to Internet using a HTTP/FTP Proxy(192.168.0.10) and the
browser(Mozilla) in my PC is configured to connect to net through the
proxy

When I tried to connect to our ftp site using the following script, I
have received the message that Unable to connect.  But the same script
is working fine with a direct modem connection.

The script is 

// connect to ftp server

if(!($ftp=ftp_connect("ftp.dirw.net")))
{
print("Unable to connect");
exit;
}

Please suggest me on how to connect to the ftp site using the proxy
server.

Regards,

Vinod.B




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




[PHP] Connection pool extension?

2003-01-08 Thread Vinod Panicker
Hi,

I was wondering if there is a php extension available that allows me to
do the following -

1.  Connect to a given IP address and port
2.  Allow me to send and receive data from a particular ip and port
3.  Pool the connections so that further requests to the given ip
and port will reuse the existing connection

Tx,
Vinod.

---
Vinod Panicker <[EMAIL PROTECTED]>
Sr. Software Designer
Geodesic Information Systems Ltd. 



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




RE: [PHP] Connection pool extension?

2003-01-08 Thread Vinod Panicker
Hi,

Thanks for the quick response - I am aware of PHP's support for sockets,
but since I cant store persistent connection information in a PHP script
I was looking out for a module

Tx,
Vinod.

---
Vinod Panicker <[EMAIL PROTECTED]>
Sr. Software Designer
Geodesic Information Systems Ltd. 



-Original Message-
From: Timothy Hitchens (HiTCHO) [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, January 09, 2003 1:00 PM
To: 'Vinod Panicker'; [EMAIL PROTECTED]
Subject: RE: [PHP] Connection pool extension?


PHP supports sockets check out:

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


Timothy Hitchens (HiTCHO)
Open Platform Consulting
e-mail: [EMAIL PROTECTED]

> -Original Message-
> From: Vinod Panicker [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 9 January 2003 5:31 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Connection pool extension?
> 
> 
> Hi,
> 
> I was wondering if there is a php extension available that
> allows me to do the following -
> 
> 1.Connect to a given IP address and port
> 2.Allow me to send and receive data from a particular ip and port
> 3.Pool the connections so that further requests to the given ip
> and port will reuse the existing connection
> 
> Tx,
> Vinod.
> 
> ---
> Vinod Panicker <[EMAIL PROTECTED]>
> Sr. Software Designer
> Geodesic Information Systems Ltd.
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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


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




[PHP] How to connect Web database

2002-10-06 Thread Vinod Bhaskar

Hi Friends,
I am having a local MySQL database & tables in Linux and the data is 
updated in the table using PHP scripts working through apache web server. 
local MySQL database is connected using the following php scripts.

mysql_connect("localhost","root","vinodb")
or die ("cannot connect to mysqld");

mysql_select_db("lnnet")
or die("cannot select database");

I have created same database and tables which is available locally on web 
which is having MySQL & PHP
support. Now I want to update the web database from the local database 
using php scripts.
How do I connect web database and local database simultaneously. I will be 
grateful, if any body can
mail me the connecting scripts, so that I can write php scripts to update 
the records from local database.
or can any body suggest a solution on how to update the tables.

Regards,
Vinod.


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




[PHP] How to connect Web Database from local machine

2002-10-06 Thread Vinod Bhaskar

Hi all,

I am having MySQL database on web. (eg., at www.lmcr.net). What is the PHP
script which I can connect the MySQL table from my Local machine. Can
anybody help me.

Regards,

Vinod.


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




[PHP] Re: Calendars

2002-06-10 Thread Vinod Palan

hi ,
here is file calendar.php and it displayes calendar and also by you can
diaplay content by selecting from database and displaying in the right month
I hope this helps and if there is any thing else do get back to me.
Vinod
==
\n\n\n".
"<!--\nTD{ FONT-FAMILY:verdana,arial; FONT-SIZE:11; }\n-->\n".
"Calendar\n\n\n\n\n";
 }


//- This function is to do the HTML footer
chore-
function  print_HTML_footer()
 {
  echo "";
 }
?>

<!--
function submit_close(month,day,year)
{
 <?if ($date_format == "mm-dd-")
 {?>
 newdate = month + "-" + day + "-" + year;
 <?}else{?>
 newdate = day + "-" + month + "-" + year;
 <?}?>
 window.opener.<?print trim($form_name);?>.<?print
trim($return_to);?>.value=newdate;
 window.close()

}
//-->


 $no_days_in_month)
 break;
   else
   {
$dates[$row][$col] = $num;
if (($col + 1) > 7)
 {
  $row++;
  $col = 1;
 }
else
 $col++;
$num++;
   }//if-else
  }//while
  $mon_num = date("n",$first_day);
  $temp_yr = $next_yr = $prev_yr = $year;

  $prev = $mon_num - 1;
  $next = $mon_num + 1;

  //If January is currently displayed, month previous is December of
previous year
  if ($mon_num == 1)
   {
$prev_yr = $year - 1;
$prev = 12;
   }

  //If December is currently displayed, month next is January of next year
  if ($mon_num == 12)
   {
$next_yr = $year + 1;
$next = 1;
   }
  ?>
  ";

  echo  "\n ".
"<< ".
"".date("F",$first_day)." ".$temp_yr."".
" ".
">> ";

  echo "\nSunMonTue";
  echo
"WedThuFriSat";
  echo " ";

  $end = ($start_day > 4)? 6:5;
  for ($row=1;$row<=$end;$row++)
   {
for ($col=1;$col<=7;$col++)
 {
  if ($dates[$row][$col] == "")
  $dates[$row][$col] = " ";

  if (!strcmp($dates[$row][$col]," "))
   $count++;

  $t = $dates[$row][$col];

  //If date is today, highlight it
  if (($t == date("j")) && ($mon == date("n")) && ($year == date("Y")))
   echo "\n".$t."";
  else
   //If the date is absent ie after 31, print space
   echo "\n".(($t == " " )? " " :"".$t."")."";
 }// for -col

if (($row + 1) != ($end+1))
 echo "\n";
else
 echo "";
   }// for - row
  echo "\n";
 }




//--Main Loop---

print_HTML_header();

//If $month is not present, set it to current month.
$month = (empty($month)) ? date("n") : $month;

//If $year is not present, set it to current year.
$year = (empty($year)) ? date("Y") : $year;

print_calendar($month,$year);

print_HTML_footer();

?>




==

--
Vinod Palan A
Calypso Technology, Inc.
[EMAIL PROTECTED]
(415) 817-2463 Phone



"Kevin P" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi
> I am trying to feature a calendar on a web site. I would like it to
display
> on a page and be able to change to another month when this is requested
and
> display items for the general public. I want the client to be able to go
> into the database and update the items and those items to appear on the
> site. Is there something outthere already packaged like this?
>
> Kevin P
>
>
>



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




[PHP] dbf Help

2002-07-22 Thread Vinod Palan

Hi,
I have already php installed on linux running with mysql enabled.
Now I wanted to read dbf files and I came to know that we need to install
php with


**
Installation
In order to use these functions, you must compile PHP with
the --enable-dbase option.

**


Does this means I have to uninstall my existing php and reinstall as above ?

Can I keep my existing setting and have dbf function install without
reinstalling whole php?

Thanks

Vinod




--
Vinod Palan A
Calypso Technology, Inc.
[EMAIL PROTECTED]
(415) 817-2463 Phone






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




[PHP] Re: textarea problem

2002-05-15 Thread Vinod Palan

Hi
I think that would be problem of the method you are using.
Can you tell if you were using post method?

Thanks
Vinod

"Tim Ward" <[EMAIL PROTECTED]> wrote in message 
01D892A483EAD511926A00500416D3C01C6B49@HUNTERS-MAIL">news:01D892A483EAD511926A00500416D3C01C6B49@HUNTERS-MAIL...
Are you POSTing or GETting the data?

Tim Ward
www.chessish.com <http://www.chessish.com> 

--
From:  Enrique Vadillo [SMTP:[EMAIL PROTECTED]]
Sent:  14 May 2002 01:33
To:  [EMAIL PROTECTED]
Subject:  textarea problem

Hi,

I'm not sure if this is purely a PHP problem but here it goes:

i have a form that sends text data to a PHP script, i have some
textarea field which goes like this:



everytime i POST this, $mynote is truncated to 1867 bytes, i have
repeatedly tried to submit text 2500 bytes long but it's always
truncated to that size -btw there is no javascript or anything in
the
middle that might modify the size- my questions is: do i have to
setup anything special in my php.ini? i have this in my php.ini:

post_max_size = 30M

I have also noticed that Hotmail has no problem sending textarea
input 2500 bytes long or more using exactly the same tags.. what's
wrong then? I use Apache 1.3.23 and PHP 4.1.1 (on RedHat 7.1)

if anyone has encountered this problem b4, i'd appreciate some help.

Enrique-



_
Únase con MSN Hotmail al servicio de correo electrónico más grande
del 
mundo. http://www.hotmail.com




[PHP] Date Function in Php

2002-05-15 Thread Vinod Palan

hi ,
Do any one have date functions like that we have in asp 1) Dateadd()
2) Datediff()
etc?
Thanks
Vinod


--
Vinod Palan A
Calypso Technology, Inc.
[EMAIL PROTECTED]
(415) 817-2463 Phone






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




[PHP] Re: PHP editor (win)

2002-05-15 Thread Vinod Palan

Hi,
I am using Editplus and I feel satisfied while using it.
you can give a try..
Vinod

--
Vinod Palan A
Calypso Technology, Inc.
[EMAIL PROTECTED]
(415) 817-2463 Phone



"Juan Pablo Aqueveque" <[EMAIL PROTECTED]> wrote in message
5.1.0.14.2.20020515102655.00a86040@www2">news:5.1.0.14.2.20020515102655.00a86040@www2...
Hi guys

I know this question it's very recurrent but the problem of Jon Yates make
me think again this stuff.

Somebody knows a quick editor, simply and with highlight?

:) Jp

I have tried : PHPEdit, DevPad



Juan Pablo Aqueveque <[EMAIL PROTECTED]>
Ingeniero de Sistemas
Departamento de Redes y Comunicaciones http://www.drc.uct.cl
Universidad Católica de Temuco.
Tel:(5645) 205 630 Fax:(5645) 205 628






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




[PHP] Re: Plz dont hate me for this

2002-05-15 Thread Vinod Palan

hey ,
there is one that I have used.
http://free4sure.com/free-hosting.html
you can give a try here..

Vinod

--
Vinod Palan A
Calypso Technology, Inc.
[EMAIL PROTECTED]
(415) 817-2463 Phone



"Salman Ahmed" <[EMAIL PROTECTED]> wrote in message
001c01c1fc7e$1bb35160$4a8305ca@home">news:001c01c1fc7e$1bb35160$4a8305ca@home...
Hi,

I am also PHP lover plz dont hate me for this but I really need to know any
free perl hosting company where I can host my perl script. Only
circumstances has made this that I programming in perl. I have no idea where
to put my question, as I always did programming in php and asked this list.
So I am asking this question here to, plz tell me about free CGI hosting
site.

Asking for the help and forgiveness
Statbat




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




[PHP] Re: A new GUI client for mySQL

2002-05-20 Thread Vinod Palan

hi ,
I saw this software its just query analyzer I would like users to have first
look @
http://www.anse.de/mysqlfront/

this is real good for managing mysql remotely
Thanks
Vinod

--
Vinod Palan A
Calypso Technology, Inc.
[EMAIL PROTECTED]
(415) 817-2463 Phone



"Ritesh Nadhani" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> greetings...
> Webyog has released mySQLyog, a win32 based Query
> analyzer. Its FREE and gives all the features that a
> mysql developer can ask for by a query analyzer.
> please visit www.webyog.com
> you can execute query of results of more than 10
> records, supports multiple query execution and you can
> export your data into XML, HTML and CSV and can also
> import form a text file.
> It also allows you to excute last query and lets you
> add your favourite query in a personal folder with one
> click of mouse. So you dont have to save it and open
> it.
> Please take a look at it and feel free to send your
> suggestions to [EMAIL PROTECTED]
> Ritesh
>
>
> __
> Do You Yahoo!?
> LAUNCH - Your Yahoo! Music Experience
> http://launch.yahoo.com



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




[PHP] Full-Duplex communication

2002-05-21 Thread Vinod Panicker

Hi,

We have developed a client-server application where the server 
needs to send asynchronous data to the client.  Now since we are 
using Apache/PHP/MySQL, the client needs to poll the server 
periodically for information.

I was thinking if there was some way to get around this basic 
problem.  I understand that this is how things are supposed to 
work, but it would be just great if i could PUSH data from the 
server to the client, using HTTP.

Since HTTP is a request/response based protocol, Apache would not 
send any data to the client asynchronously.  So what i was 
thinking was - If i tell the server to allow Keep-Alive 
connections, and increase the timeout value and max requests, I 
would effectively have a constant TCP connection.  Now the only 
problem would be of sending asynchronous data to the client.  
Solution?  Here goes - If there was some way in which i could get 
hold of the file descriptor(socket) that is being used by apache 
to write data to the client, then i could, from a PHP script also 
send any data to the client using the socket functions of PHP 
since i already have the socket with me.

This would mean that the client doesnt have to poll the server for 
data any more... and if the connection does get closed, the client 
could reconnect to the server asking for another keep-alive 
connection.

Now I know that this is probably the wrong place to put such a 
query - maybe the apache list would have been better.  But since 
I'm using PHP out here, i thought i'd give it a try.

Does the solution sound very outlandish?  Are there any pitfalls?  
And finally, how do i get hold of the socket?

Tx in advance,
Vinod.
_
Click below to visit monsterindia.com and review jobs in India or 
Abroad
http://monsterindia.rediff.com/jobs


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




Re: Re: [PHP] Full-Duplex communication

2002-05-21 Thread Vinod Panicker

Hi,

Tx for your very prompt reply.

Yeah, I'll post the solution as soon as I find it someplace.

Let me outline the problem in more detail -

Client (VC++) calls a PHP script on the server, specifies the 
connection type as Keep-Alive.  The PHP script, somehow (still a 
big question) gets the socket on which the apache server has 
received the client request (so that it can send data to the 
client later) and stores it in a database.

Now whenever another PHP script wants to send data asynchronously 
to the client, it gets the socket from the database, and just 
calls a write() on it.  Since the connection is still open 
(Keep-Alive), the client receives the information, and doesnt have 
to poll the server periodically.

The application of this is indeed destined for a messaging 
product, and could benefit a lot of other areas as well.

The only thing that is needed is the socket from apache.

Someone somewhere knows how to get this done, i'm sure :)

Possibly a hack into the PHP module can get this done, i'm open to 
suggestions.

Tx,
Vinod.

On Tue, 21 May 2002 Bogdan Stancescu wrote :
>Hi!
>
>I'm looking for an answer to your questions as well, so if you do 
>find a solution on other lists, could you please post it here as 
>well?
>
>Regarding the issue, your proposal wouldn't make for full-duplex 
>as far as I understand since I don't see how the client would be 
>able to send any data on the same connection _after_ getting 
>connected.
>
>What are you using on the other end of the pipe (on the client)? 
>Plain HTML? Flash? Java? Something else?
>
>Bogdan
>
>Vinod Panicker wrote:
>
>>Hi,
>>
>>We have developed a client-server application where the server 
>>needs to send asynchronous data to the client.  Now since we are 
>>using Apache/PHP/MySQL, the client needs to poll the server 
>>periodically for information.
>>
>>I was thinking if there was some way to get around this basic 
>>problem.  I understand that this is how things are supposed to 
>>work, but it would be just great if i could PUSH data from the 
>>server to the client, using HTTP.
>>
>>Since HTTP is a request/response based protocol, Apache would 
>>not send any data to the client asynchronously.  So what i was 
>>thinking was - If i tell the server to allow Keep-Alive 
>>connections, and increase the timeout value and max requests, I 
>>would effectively have a constant TCP connection.  Now the only 
>>problem would be of sending asynchronous data to the client.  
>>Solution?  Here goes - If there was some way in which i could 
>>get hold of the file descriptor(socket) that is being used by 
>>apache to write data to the client, then i could, from a PHP 
>>script also send any data to the client using the socket 
>>functions of PHP since i already have the socket with me.
>>
>>This would mean that the client doesnt have to poll the server 
>>for data any more... and if the connection does get closed, the 
>>client could reconnect to the server asking for another 
>>keep-alive connection.
>>
>>Now I know that this is probably the wrong place to put such a 
>>query - maybe the apache list would have been better.  But since 
>>I'm using PHP out here, i thought i'd give it a try.
>>
>>Does the solution sound very outlandish?  Are there any 
>>pitfalls?  And finally, how do i get hold of the socket?
>>
>>Tx in advance,
>>Vinod.
>>_
>>Click below to visit monsterindia.com and review jobs in India 
>>or Abroad
>>http://monsterindia.rediff.com/jobs
>>
>>
>
>
>

_
Click below to visit monsterindia.com and review jobs in India or 
Abroad
http://monsterindia.rediff.com/jobs


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




Re: Re: [PHP] Full-Duplex communication

2002-05-21 Thread Vinod Panicker

Hi,

It still seems like I havent made the problem clear enough.

I am aware of the print(), echo() and flush() functions and what 
they do.  It does not fit in as a solution.  Let me explain my 
problem more elaborately -
The client calls a PHP script, script_a.php on the Apache web 
server, using a Keep-Alive connection.  The script returns some 
response to the client which it uses.  Now since the connection is 
a Keep-alive, apache still has it open for reading and writing.  
When the client wants to call other scripts, it just sends the 
request over the same connection.  Now the thing is that if the 
server needs to send some ASYNCHRONOUS data to the client, without 
the client requesting for anything, a normal PHP script wont be 
able to do it, since the script would get executed by the web 
server ONLY on a client request (coz thats the way HTTP works).  
Now what i was thinking was - if i could get hold of the socket 
that is being used by apache to send data to the client, I could 
effectively write() to it, from a C++ app or a PHP script (which 
gets invoked from lets say another server).  print(), echo() etc 
are functions that write to the output stream, which is opened as 
a result of the clients request, by the web server.

I want the ability to write to a socket thats been created earlier 
- i want to steal it from Apache, so that i can use it when and 
where i like.

Functions like echo() and print() are not going to work here, i 
will have to use write() so that i can specify the socket to which 
the data has to be written!

Hope the problem is understood now.

Now for your question -
When the client wants to send data to the server, it just has to 
open a socket connection with the web server, and issue a GET or a 
POST request!  if the connection is a keep-alive connection, and 
it has already been created, the client just has to do a GET or a 
POST without the need to connect().

This mechanism, where the client frequently connects() to the 
server and checks for messages is called polling.  One way of 
reducing the high overhead of this is to reuse the connection by 
using a keep-alive connection.  A still better improvement would 
be to remove the need for a poll altogether, by doing something 
(thats what my question is all about) on the server so that it can 
send data asynchronously to the server.


Tx,
Vinod.

On Wed, 22 May 2002 Bogdan Stancescu wrote :
>For your specific problem, I think Mr. Lemos has provided a 
>viable solution (using print() or echo() and flush() whenever you 
>need to, instead of grabbing the socket and write() to it). My 
>problem however is how you envision solving the communication the 
>other way around (i.e. when the CLIENT wants to send data to the 
>server).
>
>Bogdan
>
>Vinod Panicker wrote:
>
>>Hi,
>>
>>Tx for your very prompt reply.
>>
>>Yeah, I'll post the solution as soon as I find it someplace.
>>
>>Let me outline the problem in more detail -
>>
>>Client (VC++) calls a PHP script on the server, specifies the 
>>connection type as Keep-Alive.  The PHP script, somehow (still a 
>>big question) gets the socket on which the apache server has 
>>received the client request (so that it can send data to the 
>>client later) and stores it in a database.
>>
>>Now whenever another PHP script wants to send data 
>>asynchronously to the client, it gets the socket from the 
>>database, and just calls a write() on it.  Since the connection 
>>is still open (Keep-Alive), the client receives the information, 
>>and doesnt have to poll the server periodically.
>>
>>The application of this is indeed destined for a messaging 
>>product, and could benefit a lot of other areas as well.
>>
>>The only thing that is needed is the socket from apache.
>>
>>Someone somewhere knows how to get this done, i'm sure :)
>>
>>Possibly a hack into the PHP module can get this done, i'm open 
>>to suggestions.
>>
>>Tx,
>>Vinod.
>>
>>On Tue, 21 May 2002 Bogdan Stancescu wrote :
>>
>>>Hi!
>>>
>>>I'm looking for an answer to your questions as well, so if you 
>>>do find a solution on other lists, could you please post it 
>>>here as well?
>>>
>>>Regarding the issue, your proposal wouldn't make for 
>>>full-duplex as far as I understand since I don't see how the 
>>>client would be able to send any data on the same connection 
>>>_after_ getting connected.
>>>
>>>What are you using on the other end of the pipe (on the 
>>>client)? Plain HTML? Flash? Java? Something else?
>>>
>>>Bogdan
>>>
>>>Vinod Panicker wrote:
>>>
>>>>Hi,
>>>>

Re: Re: Re: [PHP] Full-Duplex communication

2002-05-21 Thread Vinod Panicker

Thanks for the reply Miguel, but here i'm not trying to implement 
my own multi-threaded server - exactly the reason why i'm using 
Apache / PHP.

I could have made a listening server which is based on a 
multi-threaded or multi-forked model, but the time and 
complexities involved would be huge.  Thats why I chose Apache / 
PHP.

Now if what i'm asking for can be done, developers can easily 
leverage existing efficient server technologies (Apache) to build 
their own App servers.

I know that there is no existing function in PHP that would allow 
it to retrieve the socket from Apache ;), all i'm asking for is a 
hack that would allow me to do it.

I thought that i'd just as well post it on the mailing list before 
diving into the source code and trying to figure out for myself.  
No point trying to re-invent the wheel, right?

Evan, that lib will allow me to create my own packets, but which 
socket do i send it to?  Thats been the question all along.

I think this is getting really interesting :)

Tx,
Vinod.

On Wed, 22 May 2002 Miguel Cruz wrote :
>I don't think you're going to get Apache to hand you the 
>socket.
>
>However, you can write a program using the standalone (CGI) PHP
>interpreter that will act like a server - check out
>http://php.net/socket_create_listen for more info.
>
>You could redirect from your standard web server to your 
>listening PHP app
>running on another port. You'll then have to implement at least a 
>subset
>of the HTTP protocol in order to get browsers to talk to you.
>
>Unfortunately, since you can't - to the best of my knowledge - 
>fork a PHP
>program, you're going to have to do your own homebrew threading 
>which will
>make life slightly complicated.
>
>miguel
>
>On 22 May 2002, Vinod  Panicker wrote:
> > It still seems like I havent made the problem clear enough.
> >
> > I am aware of the print(), echo() and flush() functions and 
>what
> > they do.  It does not fit in as a solution.  Let me explain 
>my
> > problem more elaborately -
> > The client calls a PHP script, script_a.php on the Apache 
>web
> > server, using a Keep-Alive connection.  The script returns 
>some
> > response to the client which it uses.  Now since the 
>connection is
> > a Keep-alive, apache still has it open for reading and 
>writing.
> > When the client wants to call other scripts, it just sends 
>the
> > request over the same connection.  Now the thing is that if 
>the
> > server needs to send some ASYNCHRONOUS data to the client, 
>without
> > the client requesting for anything, a normal PHP script wont 
>be
> > able to do it, since the script would get executed by the 
>web
> > server ONLY on a client request (coz thats the way HTTP 
>works).
> > Now what i was thinking was - if i could get hold of the 
>socket
> > that is being used by apache to send data to the client, I 
>could
> > effectively write() to it, from a C++ app or a PHP script 
>(which
> > gets invoked from lets say another server).  print(), echo() 
>etc
> > are functions that write to the output stream, which is opened 
>as
> > a result of the clients request, by the web server.
> >
> > I want the ability to write to a socket thats been created 
>earlier
> > - i want to steal it from Apache, so that i can use it when 
>and
> > where i like.
> >
> > Functions like echo() and print() are not going to work here, 
>i
> > will have to use write() so that i can specify the socket to 
>which
> > the data has to be written!
> >
> > Hope the problem is understood now.
> >
> > Now for your question -
> > When the client wants to send data to the server, it just has 
>to
> > open a socket connection with the web server, and issue a GET 
>or a
> > POST request!  if the connection is a keep-alive connection, 
>and
> > it has already been created, the client just has to do a GET 
>or a
> > POST without the need to connect().
> >
> > This mechanism, where the client frequently connects() to 
>the
> > server and checks for messages is called polling.  One way 
>of
> > reducing the high overhead of this is to reuse the connection 
>by
> > using a keep-alive connection.  A still better improvement 
>would
> > be to remove the need for a poll altogether, by doing 
>something
> > (thats what my question is all about) on the server so that it 
>can
> > send data asynchronously to the server.
> >
> >
> > Tx,
> > Vinod.
> >
> > On Wed, 22 May 2002 Bogdan Stancescu wrote :
> > >For your specific problem, I think Mr. Lemos h

Re: Re: Re: [PHP] Full-Duplex communication

2002-05-21 Thread Vinod Panicker

What i have at the other end is a Instant Messenger client :)

Cant have the script running till the time the user logs out can 
i?  And also, different activities are triggered on the server 
asynchronously (presence status, instant messages, notifications) 
which has to be sent to the client.

Tx,
Vinod.

On Wed, 22 May 2002 Richard Archer wrote :
>At 5:55 AM + 22/5/02, Vinod  Panicker wrote:
>
> >I want the ability to write to a socket thats been created 
>earlier
> >- i want to steal it from Apache, so that i can use it when 
>and
> >where i like.
>
>Why not just keep your script running and have it send more 
>data
>to the browser whenever it becomes available. The browser will
>add the new data to the page on display.
>
>With some clever use of DHTML you could probably make the 
>existing
>content be updated with the new material.
>
>When a browser wants to trigger an update it will close the
>existing connection and open a new one. Your running script 
>will
>be killed by apache and your new one would build a base page 
>and
>start streaming the data in it's place.
>
>I see nothing here more complicated than a long-running script 
>and
>perhaps sessions to manage the browser-initiated connections.
>
>  ...Richard.
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>

_
Click below to visit monsterindia.com and review jobs in India or 
Abroad
http://monsterindia.rediff.com/jobs


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




Re: [PHP] Mcrypt: Blowfish or Twofish or no fish? Part 2

2002-05-21 Thread Vinod Panicker

Yes Jimmy, you are correct.  MD5 is a one-way hash.  Its used for 
getting a unique fingerprint of some data (like files / passwords 
etc) so that it can be compared with another MD5 hash.

Thats the point of a hashing algorithm like MD5 and SHA1 - you 
should never need to decrypt the data.

Refer to how Digital signatures and PKI works - they use MD5 
hashes.

The next question - A bigger keylength means stronger encryption - 
but it also means more CPU cycles.

A bigger blocksize means that bigger chunks of data are encrypted 
at a time.

Its always a balance that needs to be found over here - you cant 
use a keylength that is 2048 bits - it will give u the strongest 
encryption, but it will also take a lot of time.

Tx,
Vinod.

On Wed, 22 May 2002 Jimmy Lantz wrote :
>Thanx for the suggestions!
>Someone mentioned that I could use MD5 and then encrypt the 
>hash,
>how would I ever decrypt that? Is'nt MD5 a 1-way thing only?
>
>Another question?
>Should I go for bigger keylength or bigger blocksize or both? 
>What makes for the best encryption?
>
>/ Jim
>
>(and before someone suggest that I read the book Applied 
>cryptography it's already orderd and on it's way :-) )
>
>
>-- PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>

_
Click below to visit monsterindia.com and review jobs in India or 
Abroad
http://monsterindia.rediff.com/jobs


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




Re: [PHP] Full-Duplex communication

2002-05-22 Thread Vinod Panicker

Hi Richard,

Thanks for your suggestion.

Yes, Apache is the wrong platform for the server.  What would be 
ideal is a custom designed TCP based multi-threaded server.

Since we had lots of constraints, we went in for Apache / PHP.  
What i'm trying to do is to reduce the number of compromises being 
made in this architecture.

If i have a long running script, the script is still "polling" the 
database, wasting precious server CPU cycles.  Having an open 
socket on which the server calls select() is much less CPU 
intensive.

"Instant" is how the response should be.  Thats why i'm clamouring 
for the socket so that i can send data directly to the client, 
 from a C++ binary or maybe another script.

And to have the script running for hours, i would have to change 
the script timeout to a ludicrous setting, which would leave open 
many more possiblities for other problems.

Tx,
Vinod.

On Wed, 22 May 2002 Richard Archer wrote :
>At 7:01 AM + 22/5/02, Vinod  Panicker wrote:
>
> >What i have at the other end is a Instant Messenger client :)
>
>Which is presumably accepting some form of HTML or at least a
>stream of data sent over HTTP and displaying the data. If it's
>notdoing this, Apache is almost certainly the wrong platform
>for the server!!
>
>So, just keep on streaming the data to the client. Keep the
>script running and keep on sending the message.
>
>If you need to have the client send a status stream to the
>server, have it trigger a new message which will be received
>by a second script on the server. This script would insert the
>new status for that client in a database and the long-running
>script would periodically poll the database and act upon
>whatever status info it finds. Might not be "instant" update,
>but that's dependent on how often you poll for change of 
>status.
>
>
> >Cant have the script running till the time the user logs out 
>can
> >i?
>
>Why not? You're planning on sending data to them until they log
>out, so why not keep one script running?
>
>  ...R.
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>

_
Click below to visit monsterindia.com and review jobs in India or 
Abroad
http://monsterindia.rediff.com/jobs


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




Re: Re: [PHP] Full-Duplex communication

2002-05-22 Thread Vinod Panicker

Just subscribed to comp.infosystems

True, the listen-fork model would hardly be any lines of code, but 
the changes that will have to be done to the client and the server 
would be enormous.  We are talking abt a production system here 
which needs to be optimised.  I cant honestly go ahead for a 
solution that would involve such a huge re-write :( though i'd 
love to do that using PHP.

Just wanted to take the chance to give a huge CONGRATS to the PHP 
dev team for making such an AMAZING server-side scripting 
language.  Beats the shit out of anything else (personal opinion 
:))

And looking at the pace at which the development and feature 
additions are going on, wont be long before we have our very own 
"PHP-OS" !!! (for all i know, it might be already there)

Keep up the great work guys!

Tx,
Vinod.

On Wed, 22 May 2002 Miguel Cruz wrote :
>On Wed, 22 May 2002, Miguel Cruz wrote:
> > On 22 May 2002, Vinod  Panicker wrote:
> >> "Instant" is how the response should be.  Thats why i'm 
>clamouring
> >> for the socket so that i can send data directly to the 
>client,
> >> from a C++ binary or maybe another script.
> >
> > If you're willing to write C code, I'd suggest posing your 
>question in
> > comp.infosystems.www.servers.unix, where people will be happy 
>to tell you
> > about Apache APIs that may be of use.
>
>And, to be honest, the listen-fork model is so simple that it's 
>not as if
>you're doing a whole lot of work implementing it in PHP. You're 
>looking at
>about 15 lines of code for a model case.
>
>miguel
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>

_
Click below to visit monsterindia.com and review jobs in India or 
Abroad
http://monsterindia.rediff.com/jobs


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




Re: RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? part 3

2002-05-22 Thread Vinod Panicker

There is no use of hashing in file-encryption except to use it as 
a check - to see if the decrypted file matches the original file.  
To do this check, you can use either MD5 or SHA1.  The choice is 
urs.

If ur looking for a good encryption algorithm, you might want to 
consider AES (Rijndael).  It supports encryption using different 
key sizes as well as all modes.

You can take your pick from ECB / CBC also.  For binary file 
encryption, i would recommend ECB mode.  For text files, it would 
be better that you use CBC mode.

Tx,
Vinod.

On Wed, 22 May 2002 Jimmy Lantz wrote :
>
>
>>I believe that twofish has been successfully broken, so use 
>>blowfish
>>instead. Typically, for encrypting files you will use an 
>>algorithm like
>>blowfish in cbc mode (as opposed to ebc mode) but I don't know 
>>if Mcrypt
>>supports this. Also, when creating the hash of the file, it is 
>>probably best
>>to use SHA-1 instead of MD5, as there appears to be some concern 
>>with MD5
>>over it's compression function.
>>HTH
>>JH
>
>It helps :)
>I have been looking into Blowfish with cbc mode :)
>If I use SHA-1 it's still no way to dehash it during decryption 
>of the file,
>so I fail to see the use of Hashing in fileencryption.
>Could someone enlighten me?
>/ Jim
>
>
>-- PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>

_
Click below to visit monsterindia.com and review jobs in India or 
Abroad
http://monsterindia.rediff.com/jobs


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




Re: RE: RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? part 3

2002-05-22 Thread Vinod Panicker

And why not use AES, which is an industry standard and having 
being proven as the best encryption algorithm in recent times?

http://csrc.nist.gov/encryption/aes/aesfact.html

As far as ECB mode is concerned, I dont know what problems you are 
talking about.  I'm aware that the data gets encrypted in 
independed blocks and its easier to crack it, but its faster than 
other modes.

Tx,
Vinod.

On Wed, 22 May 2002 John Horton wrote :
>why use AES? Blowfish can have a 448 bit key size! Also, why use 
>ebc mode
>with all the problems which come with it?
>JH
>
>-Original Message-
> From: Vinod Panicker [mailto:[EMAIL PROTECTED]]
>Sent: 22 May 2002 10:06
>To: Jimmy Lantz
>Cc: [EMAIL PROTECTED]
>Subject: Re: RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? 
>part 3
>
>
>There is no use of hashing in file-encryption except to use it 
>as
>a check - to see if the decrypted file matches the original 
>file.
>To do this check, you can use either MD5 or SHA1.  The choice 
>is
>urs.
>
>If ur looking for a good encryption algorithm, you might want 
>to
>consider AES (Rijndael).  It supports encryption using 
>different
>key sizes as well as all modes.
>
>You can take your pick from ECB / CBC also.  For binary file
>encryption, i would recommend ECB mode.  For text files, it 
>would
>be better that you use CBC mode.
>
>Tx,
>Vinod.
>
>On Wed, 22 May 2002 Jimmy Lantz wrote :
> >
> >
> >>I believe that twofish has been successfully broken, so use
> >>blowfish
> >>instead. Typically, for encrypting files you will use an
> >>algorithm like
> >>blowfish in cbc mode (as opposed to ebc mode) but I don't 
>know
> >>if Mcrypt
> >>supports this. Also, when creating the hash of the file, it 
>is
> >>probably best
> >>to use SHA-1 instead of MD5, as there appears to be some 
>concern
> >>with MD5
> >>over it's compression function.
> >>HTH
> >>JH
> >
> >It helps :)
> >I have been looking into Blowfish with cbc mode :)
> >If I use SHA-1 it's still no way to dehash it during 
>decryption
> >of the file,
> >so I fail to see the use of Hashing in fileencryption.
> >Could someone enlighten me?
> >/ Jim
> >
> >
> >-- PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>_
>Click below to visit monsterindia.com and review jobs in India 
>or
>Abroad
>http://monsterindia.rediff.com/jobs
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

_
Click below to visit monsterindia.com and review jobs in India or 
Abroad
http://monsterindia.rediff.com/jobs


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




Re: RE: RE: RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? part 3

2002-05-22 Thread Vinod Panicker

Thats why lots of people like Blowfish, including myself.  I am 
using it in a production environment with PHP and mcrypt.

In ECB mode, the blocks are encrypted independently, whereas in 
CBC mode, the blocks are encrypted with information based on the 
previous block.

What this means is that if a particular block which was encrypted 
using ECB mode is decrypted, it would show the plain text, whereas 
it wont happen if the data was encrypted using CBC mode.

Plain text files can be seen and understood, whereas its much more 
difficult to understand if the crack attempt on a block of binary 
data was successful, since the data wont necessarily make any 
sense.

Tx,
Vinod.

On Wed, 22 May 2002 John Horton wrote :
>One of the reasons I like Blowfish is that I have used it for 
>years, and
>there have been no successfull attempts to crack it.
>Why do you encrypt binary files in ebc and text files in cbc?
>JH
>-Original Message-
> From: Vinod Panicker [mailto:[EMAIL PROTECTED]]
>Sent: 22 May 2002 10:25
>To: John Horton
>Cc: [EMAIL PROTECTED]; Jimmy Lantz
>Subject: Re: RE: RE: [PHP] Mcrypt: Blowfish or Twofish or no 
>fish? part
>3
>
>
>And why not use AES, which is an industry standard and having
>being proven as the best encryption algorithm in recent times?
>
>http://csrc.nist.gov/encryption/aes/aesfact.html
>
>As far as ECB mode is concerned, I dont know what problems you 
>are
>talking about.  I'm aware that the data gets encrypted in
>independed blocks and its easier to crack it, but its faster 
>than
>other modes.
>
>Tx,
>Vinod.
>
>On Wed, 22 May 2002 John Horton wrote :
> >why use AES? Blowfish can have a 448 bit key size! Also, why 
>use
> >ebc mode
> >with all the problems which come with it?
> >JH
> >
> >-Original Message-
> > From: Vinod Panicker [mailto:[EMAIL PROTECTED]]
> >Sent: 22 May 2002 10:06
> >To: Jimmy Lantz
> >Cc: [EMAIL PROTECTED]
> >Subject: Re: RE: [PHP] Mcrypt: Blowfish or Twofish or no 
>fish?
> >part 3
> >
> >
> >There is no use of hashing in file-encryption except to use 
>it
> >as
> >a check - to see if the decrypted file matches the original
> >file.
> >To do this check, you can use either MD5 or SHA1.  The choice
> >is
> >urs.
> >
> >If ur looking for a good encryption algorithm, you might want
> >to
> >consider AES (Rijndael).  It supports encryption using
> >different
> >key sizes as well as all modes.
> >
> >You can take your pick from ECB / CBC also.  For binary file
> >encryption, i would recommend ECB mode.  For text files, it
> >would
> >be better that you use CBC mode.
> >
> >Tx,
> >Vinod.
> >
> >On Wed, 22 May 2002 Jimmy Lantz wrote :
> > >
> > >
> > >>I believe that twofish has been successfully broken, so 
>use
> > >>blowfish
> > >>instead. Typically, for encrypting files you will use an
> > >>algorithm like
> > >>blowfish in cbc mode (as opposed to ebc mode) but I don't
> >know
> > >>if Mcrypt
> > >>supports this. Also, when creating the hash of the file, 
>it
> >is
> > >>probably best
> > >>to use SHA-1 instead of MD5, as there appears to be some
> >concern
> > >>with MD5
> > >>over it's compression function.
> > >>HTH
> > >>JH
> > >
> > >It helps :)
> > >I have been looking into Blowfish with cbc mode :)
> > >If I use SHA-1 it's still no way to dehash it during
> >decryption
> > >of the file,
> > >so I fail to see the use of Hashing in fileencryption.
> > >Could someone enlighten me?
> > >/ Jim
> > >
> > >
> > >-- PHP General Mailing List (http://www.php.net/)
> > >To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >_
> >Click below to visit monsterindia.com and review jobs in 
>India
> >or
> >Abroad
> >http://monsterindia.rediff.com/jobs
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
>_
>Click below to visit monsterindia.com and review jobs in India 
>or
>Abroad
>http://monsterindia.rediff.com/jobs

_
Click below to visit monsterindia.com and review jobs in India or 
Abroad
http://monsterindia.rediff.com/jobs


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




Re: [PHP] Full-Duplex communication

2002-05-23 Thread Vinod Panicker

Hi Evan,

What you said did make sense, and complements my knowledge of 
sockets.

But what i'm not sure of is this - if i construct my own packet 
and send it across, presuming that i do have the ip address and 
port number of the client on which it is reading, will the client 
accept it as a legitimate packet?

I suspect that since the packets would be having some kind of 
session identifier / sequence number.

Getting the ip address and port number is no problem.  I already 
have that getting stored on the server.  But from what i know of 
sockets, i'm sceptical if the client will accept the packet.

Guess the only way to go ahead is to try this out.

Would someone pls pls pls write a PHP interface to libnet??

Tx,
Vinod.

On Thu, 23 May 2002 Evan Nemerson wrote :
>You're right- this is getting interesting ;)
>
>http://www.packetfactory.net/libnet/manual/4.html#s4.1.5
>
>Unless I'm mistaken, you don't need to actually hijack the 
>socket- you merely
>need to write to the network. Check out section 3.1 of RFC 793. 
>There is
>source and destination port- that is how they are routed. Okay 
>anyone PLEASE
>correct me if i'm wrong...
>
>My understanding is a socket is an interface to the kernel. So 
>basically, you
>talk to a socket, which the kernel associates with source and 
>destination
>ports, and destination IP address. Thats why you can just write 
>to a socket
>instead of explicitly stating all the information. The kernel 
>then sends out
>then creates the packet and send it to the destination IP.
>
>libnet would allow you to bypass the socket phase, and manually 
>create a
>socket. Think of a socket as a GUI for the network, and libnet is 
>like a
>console ;)
>
>Hope that helps, and once again anyone PLEASE correct any 
>inaccuracies, since
>I want to know.
>
>
>
>
>On Tuesday 21 May 2002 23:53 pm, Vinod Panicker wrote:
> > Thanks for the reply Miguel, but here i'm not trying to 
>implement
> > my own multi-threaded server - exactly the reason why i'm 
>using
> > Apache / PHP.
> >
> > I could have made a listening server which is based on a
> > multi-threaded or multi-forked model, but the time and
> > complexities involved would be huge.  Thats why I chose Apache 
>/
> > PHP.
> >
> > Now if what i'm asking for can be done, developers can 
>easily
> > leverage existing efficient server technologies (Apache) to 
>build
> > their own App servers.
> >
> > I know that there is no existing function in PHP that would 
>allow
> > it to retrieve the socket from Apache ;), all i'm asking for 
>is a
> > hack that would allow me to do it.
> >
> > I thought that i'd just as well post it on the mailing list 
>before
> > diving into the source code and trying to figure out for 
>myself.
> > No point trying to re-invent the wheel, right?
> >
> > Evan, that lib will allow me to create my own packets, but 
>which
> > socket do i send it to?  Thats been the question all along.
> >
> > I think this is getting really interesting :)
> >
> > Tx,
> > Vinod.
> >
> > On Wed, 22 May 2002 Miguel Cruz wrote :
> > >I don't think you're going to get Apache to hand you the
> > >socket.
> > >
> > >However, you can write a program using the standalone (CGI) 
>PHP
> > >interpreter that will act like a server - check out
> > >http://php.net/socket_create_listen for more info.
> > >
> > >You could redirect from your standard web server to your
> > >listening PHP app
> > >running on another port. You'll then have to implement at 
>least a
> > >subset
> > >of the HTTP protocol in order to get browsers to talk to 
>you.
> > >
> > >Unfortunately, since you can't - to the best of my knowledge 
>-
> > >fork a PHP
> > >program, you're going to have to do your own homebrew 
>threading
> > >which will
> > >make life slightly complicated.
> > >
> > >miguel
> > >
> > >On 22 May 2002, Vinod  Panicker wrote:
> > > > It still seems like I havent made the problem clear 
>enough.
> > > >
> > > > I am aware of the print(), echo() and flush() functions 
>and
> > >
> > >what
> > >
> > > > they do.  It does not fit in as a solution.  Let me 
>explain
> > >
> > >my
> > >
> > > > problem more elaborately -
> > > > The client calls a PHP script, script_a.php on the 
>Apache
> > >
> > >web
> > 

Re: Re: [PHP] Full-Duplex communication

2002-05-23 Thread Vinod Panicker

LOL.. I like the color red BTW.

Let me explain my project more in detail.

This system is an Instant messaging system, with the backed 
running on apache / php / mysql.  The front end client is a COM 
component that communicates with the backend, and interfaces with 
an MFC app.

Now since Instant messaging requires that the server should be 
able to send asynchronous messages to the client (Presence, IM's, 
notifications, etc), and HTTP does not allow asynchronous 
communication, the only solution is to have the client poll the 
server for messages.

Now i know that apache / php is not a good solution for an instant 
messaging server, but we needed it to be ready in a months time, 
and php is so amazing that we could get it up and running so fast.  
But it meant that we have to live with latency between messages 
because of the polling.

So i was thinking if there was some way in which i could avoid the 
polling and send data asynchronously to the client (Pls refer to 
my previous posts).  Thats why i was looking at a way in which i 
could get hold of the socket to the client, so i could use it to 
send data directly.

Tx,
Vinod.

On Fri, 24 May 2002 Miguel Cruz wrote :
>Not to be argumentative, but what you're trying to do is just so 
>amazingly
>much more complicated than any of my suggestions. Maybe I 
>haven't
>communicated it well, it maybe there's some requirement to your 
>project
>that I don't understand.
>
>Why not just write a listener in PHP and redirect to it? It's 
>basically no
>work.
>
>Handcrafting packets for this purpose is like building a car out 
>of paper
>clips and cat hair because the car that's freely available to you 
>is red -
>and you don't like the color red because your old girlfriend used 
>to wear
>it a lot.
>
>miguel
>
>On 23 May 2002, Vinod  Panicker wrote:
> > What you said did make sense, and complements my knowledge 
>of
> > sockets.
> >
> > But what i'm not sure of is this - if i construct my own 
>packet
> > and send it across, presuming that i do have the ip address 
>and
> > port number of the client on which it is reading, will the 
>client
> > accept it as a legitimate packet?
> >
> > I suspect that since the packets would be having some kind 
>of
> > session identifier / sequence number.
> >
> > Getting the ip address and port number is no problem.  I 
>already
> > have that getting stored on the server.  But from what i know 
>of
> > sockets, i'm sceptical if the client will accept the packet.
> >
> > Guess the only way to go ahead is to try this out.
> >
> > Would someone pls pls pls write a PHP interface to libnet??
> >
> > Tx,
> > Vinod.
> >
> > On Thu, 23 May 2002 Evan Nemerson wrote :
> > >You're right- this is getting interesting ;)
> > >
> > >http://www.packetfactory.net/libnet/manual/4.html#s4.1.5
> > >
> > >Unless I'm mistaken, you don't need to actually hijack the
> > >socket- you merely
> > >need to write to the network. Check out section 3.1 of RFC 
>793.
> > >There is
> > >source and destination port- that is how they are routed. 
>Okay
> > >anyone PLEASE
> > >correct me if i'm wrong...
> > >
> > >My understanding is a socket is an interface to the kernel. 
>So
> > >basically, you
> > >talk to a socket, which the kernel associates with source 
>and
> > >destination
> > >ports, and destination IP address. Thats why you can just 
>write
> > >to a socket
> > >instead of explicitly stating all the information. The 
>kernel
> > >then sends out
> > >then creates the packet and send it to the destination IP.
> > >
> > >libnet would allow you to bypass the socket phase, and 
>manually
> > >create a
> > >socket. Think of a socket as a GUI for the network, and 
>libnet is
> > >like a
> > >console ;)
> > >
> > >Hope that helps, and once again anyone PLEASE correct any
> > >inaccuracies, since
> > >I want to know.
> > >
> > >
> > >
> > >
> > >On Tuesday 21 May 2002 23:53 pm, Vinod Panicker wrote:
> > > > Thanks for the reply Miguel, but here i'm not trying to
> > >implement
> > > > my own multi-threaded server - exactly the reason why 
>i'm
> > >using
> > > > Apache / PHP.
> > > >
> > > > I could have made a listening server which is based on a
> > > > multi-threaded or multi-forked model, but the time and
> > > &

RE: Re: [PHP] Full-Duplex communication

2002-05-27 Thread Vinod Panicker

Hi Miguel,

I can go in for a php based listener, yes, but this system is already in
a production environment and there will be major changes required to get
it done.

If I get a chance to redevelop this, that is probably what I'll go in
for.

Tx,
Vinod.

-Original Message-
From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
Sent: Friday, May 24, 2002 10:18 PM
To: Vinod Panicker
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Re: [PHP] Full-Duplex communication


So still there is nothing in your requirements that doesn't suggest
you'll 
do fine with a PHP-based listener.

Of course you have the memory overhead of the PHP interpreter's RAM 
infrastructure multiplied by the number of simultaneous connections, but

that would be the same with Apache (at least on Unix). 

miguel

On 24 May 2002, Vinod  Panicker wrote:
> Let me explain my project more in detail.
> 
> This system is an Instant messaging system, with the backed
> running on apache / php / mysql.  The front end client is a COM 
> component that communicates with the backend, and interfaces with 
> an MFC app.
> 
> Now since Instant messaging requires that the server should be
> able to send asynchronous messages to the client (Presence, IM's, 
> notifications, etc), and HTTP does not allow asynchronous 
> communication, the only solution is to have the client poll the 
> server for messages.
> 
> Now i know that apache / php is not a good solution for an instant
> messaging server, but we needed it to be ready in a months time, 
> and php is so amazing that we could get it up and running so fast.  
> But it meant that we have to live with latency between messages 
> because of the polling.
> 
> So i was thinking if there was some way in which i could avoid the
> polling and send data asynchronously to the client (Pls refer to 
> my previous posts).  Thats why i was looking at a way in which i 
> could get hold of the socket to the client, so i could use it to 
> send data directly.
> 
> Tx,
> Vinod.
> 
> On Fri, 24 May 2002 Miguel Cruz wrote :
> >Not to be argumentative, but what you're trying to do is just so
> >amazingly
> >much more complicated than any of my suggestions. Maybe I 
> >haven't
> >communicated it well, it maybe there's some requirement to your 
> >project
> >that I don't understand.
> >
> >Why not just write a listener in PHP and redirect to it? It's
> >basically no
> >work.
> >
> >Handcrafting packets for this purpose is like building a car out
> >of paper
> >clips and cat hair because the car that's freely available to you 
> >is red -
> >and you don't like the color red because your old girlfriend used 
> >to wear
> >it a lot.
> >
> >miguel
> >
> >On 23 May 2002, Vinod  Panicker wrote:
> > > What you said did make sense, and complements my knowledge
> >of
> > > sockets.
> > >
> > > But what i'm not sure of is this - if i construct my own
> >packet
> > > and send it across, presuming that i do have the ip address
> >and
> > > port number of the client on which it is reading, will the
> >client
> > > accept it as a legitimate packet?
> > >
> > > I suspect that since the packets would be having some kind
> >of
> > > session identifier / sequence number.
> > >
> > > Getting the ip address and port number is no problem.  I
> >already
> > > have that getting stored on the server.  But from what i know
> >of
> > > sockets, i'm sceptical if the client will accept the packet.
> > >
> > > Guess the only way to go ahead is to try this out.
> > >
> > > Would someone pls pls pls write a PHP interface to libnet??
> > >
> > > Tx,
> > > Vinod.
> > >
> > > On Thu, 23 May 2002 Evan Nemerson wrote :
> > > >You're right- this is getting interesting ;)
> > > >
> > > >http://www.packetfactory.net/libnet/manual/4.html#s4.1.5
> > > >
> > > >Unless I'm mistaken, you don't need to actually hijack the
> > > >socket- you merely
> > > >need to write to the network. Check out section 3.1 of RFC
> >793.
> > > >There is
> > > >source and destination port- that is how they are routed.
> >Okay
> > > >anyone PLEASE
> > > >correct me if i'm wrong...
> > > >
> > > >My understanding is a socket is an interface to the kernel.
> >So
> > > >basically, you
> > > >talk to a socket, which the kernel associates w