473,624 Members | 2,249 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_c onnect($host,$p ort,15,'TITLE Test \nTEXT Text in
popup\nPOPUP\n' );

function socket_raw_conn ect ($server, $port, $timeout,$reque st) {
if (!is_numeric($p ort) or !is_numeric($ti meout)) {return false;}
$socket = fsockopen($serv er, $port, $errno, $errstr, $timeout);
if(!$socket) { echo "Opening socket error"; exit(); }

sleep(10); #Wait for program... bug :-)
$put=fputs($soc ket, $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 5644
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********@hot mail.com> schreef in bericht
news:41******** *************@n ews.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_c onnect($host,$p ort,15,'TITLE Test \nTEXT Text in
popup\nPOPUP\n' );

function socket_raw_conn ect ($server, $port, $timeout,$reque st) {
if (!is_numeric($p ort) or !is_numeric($ti meout)) {return false;}
$socket = fsockopen($serv er, $port, $errno, $errstr, $timeout);
if(!$socket) { echo "Opening socket error"; exit(); }

sleep(10); #Wait for program... bug :-)
$put=fputs($soc ket, $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********@hot mail.com> wrote in message
news:41******** *************@n ews.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_c onnect($host,$p ort,15,'TITLE Test \nTEXT Text in
popup\nPOPUP\n' );

function socket_raw_conn ect ($server, $port, $timeout,$reque st) {
if (!is_numeric($p ort) or !is_numeric($ti meout)) {return false;}
$socket = fsockopen($serv er, $port, $errno, $errstr, $timeout);
if(!$socket) { echo "Opening socket error"; exit(); }

sleep(10); #Wait for program... bug :-)
$put=fputs($soc ket, $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******** ************@co mcast.com...
"Quarco" <do********@hot mail.com> wrote in message
news:41******** *************@n ews.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_c onnect($host,$p ort,15,'TITLE Test \nTEXT Text in
popup\nPOPUP\n' );

function socket_raw_conn ect ($server, $port, $timeout,$reque st) {
if (!is_numeric($p ort) or !is_numeric($ti meout)) {return false;}
$socket = fsockopen($serv er, $port, $errno, $errstr, $timeout);
if(!$socket) { echo "Opening socket error"; exit(); }

sleep(10); #Wait for program... bug :-)
$put=fputs($soc ket, $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.n l...
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********@hot mail.com> schreef in bericht
news:41******** *************@n ews.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_c onnect($host,$p ort,15,'TITLE Test \nTEXT Text in
popup\nPOPUP\n' );

function socket_raw_conn ect ($server, $port, $timeout,$reque st) {
if (!is_numeric($p ort) or !is_numeric($ti meout)) {return false;}
$socket = fsockopen($serv er, $port, $errno, $errstr, $timeout);
if(!$socket) { echo "Opening socket error"; exit(); }

sleep(10); #Wait for program... bug :-)
$put=fputs($soc ket, $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******** ************@co mcast.com...
"Marco" <dont_send{spam }[mps]@this.address[webmind.nl].please.com> wrote
in
message news:41******** *************** @news.wanadoo.n l...
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********@hot mail.com> schreef in bericht
news:41******** *************@n ews.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_c onnect($host,$p ort,15,'TITLE Test \nTEXT Text in
> popup\nPOPUP\n' );
>
> function socket_raw_conn ect ($server, $port, $timeout,$reque st) {
> if (!is_numeric($p ort) or !is_numeric($ti meout)) {return false;}
> $socket = fsockopen($serv er, $port, $errno, $errstr, $timeout);
> if(!$socket) { echo "Opening socket error"; exit(); }
>
> sleep(10); #Wait for program... bug :-)
> $put=fputs($soc ket, $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
2520
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 all records and sends each of them ONE BY ONE. After each record that my server script sends, it waits for the client to confirm proper reception with an ACK (binary digit). When there are no more records, my server script sends the client a binary
13
8081
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 data was received by the socket on the remote end? Can I count on that? Do I understand TCP correctly in that, it gives confirmation ? I do not expect, that a .Net based receiver got that data when socket.Send() terminates!
5
1616
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
7704
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 the app, even the first time. The application will be required to be sending out repeated emails, about one every second or two. Must this be done asynchronously? Thank you. -Greg I get the generic error messages;
3
4287
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 receiver is running within Process1. If I move the receiver into Process2 then its fast. Please can someone explain.
0
3156
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 System.Collections.Generic; using System.Net; using System.Net.Sockets; using System.Runtime.Serialization.Formatters.Binary;
11
6632
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? Can someone point me in the right direction. ifstream file; file.open(r.c_str(), ios::binary); char buffer = ""; int BytesSent = 0; int BytesIndex = 0;
1
2731
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 anything. I would love some help, here is the code: import socket import thread import time
4
10421
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, implementation must be open socket and send the buffer in chunks which is provided by the parameter.
0
8233
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8675
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8334
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8474
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7158
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6108
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2604
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.