473,385 Members | 1,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Send binary data to socket

Hi,

Quick & simple question:
I have to send the next data to a socket in order to make a popup visible on
a windows machine..

TITLE Title of popup [enter]
TEXT Text in popup [enter]
POPUP [enter]
<?
$s=socket_raw_connect($host,$port,15,'TITLE Test \nTEXT Text in
popup\nPOPUP\n');

function socket_raw_connect ($server, $port, $timeout,$request) {
if (!is_numeric($port) or !is_numeric($timeout)) {return false;}
$socket = fsockopen($server, $port, $errno, $errstr, $timeout);
if(!$socket) { echo "Opening socket error"; exit(); }

sleep(10); #Wait for program... bug :-)
$put=fputs($socket, $request);
sleep(10);
fclose($socket);
}
?>

Now, I have tried the whole scala of \r \n \r\n \0x0a etc.. for \n but it
doesn't seem to work..

Anyone a bright idea???
Thanx in advance,
Marco


Jul 17 '05 #1
6 5624
Hi Marco,

I fail to see what a popup has to do with a socket.
Really.
Are you talking about browser-popup?

That aside: What do you mean by "doesn't seem to work?"

Is the socket not accepting connections?
You didn't create a socket on a port under 1024 on *nix without being root??

Do you get an error?
Does the whole thingy time-out?

Please provide us/me with a little more information.

Regards,
Erwin Moller
Jul 17 '05 #2
Ok.. Seems the information was too little :-)

here we go with a little more info:

A friend of mine as programmed a simple popup kind of thing.
I made a scheduler in PHP, but to assure we don't forget any todo-items I
thought it would be a nice feature to let this scheduler (running on LINUX
server with apache/PHP) send messages to (in this case) my windows machine.
(e.g: call php page with aid of crontab)

Now, this friend has a reputation with Delphi (pascal) and programmed a nice
little popup application.
To use it I have to connect to (if local) 127.0.0.1 port 12345 (with SSH /
putty raw connection) and after entering the Tilte of the popup, text and
the final POPUP command, I see a nice popup with the text I entered...

....
So the commands entered in the PUTTY window are quite simple:
TITLE Title of popup window
TEXT text in popup window
POPUP

Now what I have to do (in php duh..) is sending these commands to the
client..............
So my thought would be creating a socket to the (windows) machine with the
popup-thing running and send the commands..
But it just doesn't seem to work..

If anyone of you can help me out.. PLEASE!! :-)

Thanx in advance,
Marco


"Quarco" <do********@hotmail.com> schreef in bericht
news:41*********************@news.xs4all.nl...
Hi,

Quick & simple question:
I have to send the next data to a socket in order to make a popup visible
on
a windows machine..

TITLE Title of popup [enter]
TEXT Text in popup [enter]
POPUP [enter]
<?
$s=socket_raw_connect($host,$port,15,'TITLE Test \nTEXT Text in
popup\nPOPUP\n');

function socket_raw_connect ($server, $port, $timeout,$request) {
if (!is_numeric($port) or !is_numeric($timeout)) {return false;}
$socket = fsockopen($server, $port, $errno, $errstr, $timeout);
if(!$socket) { echo "Opening socket error"; exit(); }

sleep(10); #Wait for program... bug :-)
$put=fputs($socket, $request);
sleep(10);
fclose($socket);
}
?>

Now, I have tried the whole scala of \r \n \r\n \0x0a etc.. for \n but it
doesn't seem to work..

Anyone a bright idea???
Thanx in advance,
Marco

Jul 17 '05 #3
"Quarco" <do********@hotmail.com> wrote in message
news:41*********************@news.xs4all.nl...
Hi,

Quick & simple question:
I have to send the next data to a socket in order to make a popup visible on a windows machine..

TITLE Title of popup [enter]
TEXT Text in popup [enter]
POPUP [enter]
<?
$s=socket_raw_connect($host,$port,15,'TITLE Test \nTEXT Text in
popup\nPOPUP\n');

function socket_raw_connect ($server, $port, $timeout,$request) {
if (!is_numeric($port) or !is_numeric($timeout)) {return false;}
$socket = fsockopen($server, $port, $errno, $errstr, $timeout);
if(!$socket) { echo "Opening socket error"; exit(); }

sleep(10); #Wait for program... bug :-)
$put=fputs($socket, $request);
sleep(10);
fclose($socket);
}
?>

Now, I have tried the whole scala of \r \n \r\n \0x0a etc.. for \n but it
doesn't seem to work..

Anyone a bright idea???


A firewall blocking the connection? What port are you using?

BTW: I hope you're not writing an adware.
Jul 17 '05 #4
Seemed the app. expected a timout between the commands..
No, it is _not_ an ad aware whatsoever :-)
"Chung Leong" <ch***********@hotmail.com> schreef in bericht
news:nb********************@comcast.com...
"Quarco" <do********@hotmail.com> wrote in message
news:41*********************@news.xs4all.nl...
Hi,

Quick & simple question:
I have to send the next data to a socket in order to make a popup visible

on
a windows machine..

TITLE Title of popup [enter]
TEXT Text in popup [enter]
POPUP [enter]
<?
$s=socket_raw_connect($host,$port,15,'TITLE Test \nTEXT Text in
popup\nPOPUP\n');

function socket_raw_connect ($server, $port, $timeout,$request) {
if (!is_numeric($port) or !is_numeric($timeout)) {return false;}
$socket = fsockopen($server, $port, $errno, $errstr, $timeout);
if(!$socket) { echo "Opening socket error"; exit(); }

sleep(10); #Wait for program... bug :-)
$put=fputs($socket, $request);
sleep(10);
fclose($socket);
}
?>

Now, I have tried the whole scala of \r \n \r\n \0x0a etc.. for \n but it
doesn't seem to work..

Anyone a bright idea???


A firewall blocking the connection? What port are you using?

BTW: I hope you're not writing an adware.

Jul 17 '05 #5
"Marco" <dont_send{spam}[mps]@this.address[webmind.nl].please.com> wrote in
message news:41***********************@news.wanadoo.nl...
Ok.. Seems the information was too little :-)

here we go with a little more info:

A friend of mine as programmed a simple popup kind of thing.
I made a scheduler in PHP, but to assure we don't forget any todo-items I
thought it would be a nice feature to let this scheduler (running on LINUX
server with apache/PHP) send messages to (in this case) my windows machine. (e.g: call php page with aid of crontab)

Now, this friend has a reputation with Delphi (pascal) and programmed a nice little popup application.
To use it I have to connect to (if local) 127.0.0.1 port 12345 (with SSH /
putty raw connection) and after entering the Tilte of the popup, text and
the final POPUP command, I see a nice popup with the text I entered...

...
So the commands entered in the PUTTY window are quite simple:
TITLE Title of popup window
TEXT text in popup window
POPUP

Now what I have to do (in php duh..) is sending these commands to the
client..............
So my thought would be creating a socket to the (windows) machine with the popup-thing running and send the commands..
But it just doesn't seem to work..

If anyone of you can help me out.. PLEASE!! :-)

Thanx in advance,
Marco


"Quarco" <do********@hotmail.com> schreef in bericht
news:41*********************@news.xs4all.nl...
Hi,

Quick & simple question:
I have to send the next data to a socket in order to make a popup visible on
a windows machine..

TITLE Title of popup [enter]
TEXT Text in popup [enter]
POPUP [enter]
<?
$s=socket_raw_connect($host,$port,15,'TITLE Test \nTEXT Text in
popup\nPOPUP\n');

function socket_raw_connect ($server, $port, $timeout,$request) {
if (!is_numeric($port) or !is_numeric($timeout)) {return false;}
$socket = fsockopen($server, $port, $errno, $errstr, $timeout);
if(!$socket) { echo "Opening socket error"; exit(); }

sleep(10); #Wait for program... bug :-)
$put=fputs($socket, $request);
sleep(10);
fclose($socket);
}
?>

Now, I have tried the whole scala of \r \n \r\n \0x0a etc.. for \n but it doesn't seem to work..

Anyone a bright idea???
Thanx in advance,
Marco


For this kind of thing it makes much more sense for the client to poll the
server across port 80. That way your program would still work when there's a
firewall between the two.
Jul 17 '05 #6
Funny, thought of that last night myself :-)

Still, it was a nice learning-thing ..

Thanx all for your time..

Greetz,
Marco

"Chung Leong" <ch***********@hotmail.com> schreef in bericht
news:h4********************@comcast.com...
"Marco" <dont_send{spam}[mps]@this.address[webmind.nl].please.com> wrote
in
message news:41***********************@news.wanadoo.nl...
Ok.. Seems the information was too little :-)

here we go with a little more info:

A friend of mine as programmed a simple popup kind of thing.
I made a scheduler in PHP, but to assure we don't forget any todo-items
I
thought it would be a nice feature to let this scheduler (running on
LINUX
server with apache/PHP) send messages to (in this case) my windows

machine.
(e.g: call php page with aid of crontab)

Now, this friend has a reputation with Delphi (pascal) and programmed a

nice
little popup application.
To use it I have to connect to (if local) 127.0.0.1 port 12345 (with SSH
/
putty raw connection) and after entering the Tilte of the popup, text and
the final POPUP command, I see a nice popup with the text I entered...

...
So the commands entered in the PUTTY window are quite simple:
TITLE Title of popup window
TEXT text in popup window
POPUP

Now what I have to do (in php duh..) is sending these commands to the
client..............
So my thought would be creating a socket to the (windows) machine with

the
popup-thing running and send the commands..
But it just doesn't seem to work..

If anyone of you can help me out.. PLEASE!! :-)

Thanx in advance,
Marco


"Quarco" <do********@hotmail.com> schreef in bericht
news:41*********************@news.xs4all.nl...
> Hi,
>
> Quick & simple question:
> I have to send the next data to a socket in order to make a popup visible > on
> a windows machine..
>
> TITLE Title of popup [enter]
> TEXT Text in popup [enter]
> POPUP [enter]
>
>
> <?
> $s=socket_raw_connect($host,$port,15,'TITLE Test \nTEXT Text in
> popup\nPOPUP\n');
>
> function socket_raw_connect ($server, $port, $timeout,$request) {
> if (!is_numeric($port) or !is_numeric($timeout)) {return false;}
> $socket = fsockopen($server, $port, $errno, $errstr, $timeout);
> if(!$socket) { echo "Opening socket error"; exit(); }
>
> sleep(10); #Wait for program... bug :-)
> $put=fputs($socket, $request);
> sleep(10);
> fclose($socket);
> }
> ?>
>
> Now, I have tried the whole scala of \r \n \r\n \0x0a etc.. for \n but it > doesn't seem to work..
>
> Anyone a bright idea???
>
>
> Thanx in advance,
> Marco
>
>
>
>


For this kind of thing it makes much more sense for the client to poll the
server across port 80. That way your program would still work when there's
a
firewall between the two.

Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Lisa Pearlson | last post by:
Hi, My php application (on Apache/Linux) needs to do the following: The PHP script receives a request from a client (binary), asking for certain records of data. My PHP script loops through...
13
by: Manfred Braun | last post by:
Hi All, I am trying to understand the blocking method socket.Send(). The call blocks as expected, but does this mean, it returnes after the underlying TCP layer got a confirmation, that the send...
5
by: nicolas ETIENNE | last post by:
Hello, I want to send through Socket a struct So, i'd like to do, as I did before in C++, something like send((void*)myStruct); where myStruct is a struct with basic types
11
by: hazz | last post by:
smtpClient.Send(message) is causing me problems as per specifics in the trace below. Email is sent but not without this error typically upon sending the second email, but sometimes when running...
3
by: BuddyWork | last post by:
Hello, Could someone please explain why the Socket.Send is slow to send to the same process it sending from. Eg. Process1 calls Socket.Send which sends to the same IP address and port, the...
0
by: Buddy Home | last post by:
There is two examples of code. Example 1. Send and Receive within the same process. Put this code in a console app called SendAndReceive and run the code. using System; using...
11
by: iwasinnihon | last post by:
I writing a program that will send both a text/html document as well as jpegs using winsock. My code works find for the text, but will not work with jpegs. My code is below. What am I missing? ...
1
by: danfolkes | last post by:
Hey Everyone, I am trying to send repeated messages from a "Node" to a "Server". It works the first time I send the from the Node to Server, but after that it either errors, or does not do...
4
by: gvijayaratnam | last post by:
Hi All, I have a fn prototype as follows void print ( char *Buffer, usigned long bufferSize, int chunkSize ); This fn will accept binary file buffer and the buffer size and the chunk size,...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.