04-12-2002
It would be better if we could see your code (excerpts) that
setup and do the message exchange. There are some operations
in which you must interleave reads and writes but if you wrote
some sort of socket (UNIX or INET) communications, this should
not be an issue. If you can't post code excerpts, try to give
as much detail about what you are doing and how you are doing
it. Maybe someone can help.
10 More Discussions You Might Find Interesting
1. Programming
I use fopen, fscanf, fclose to read a file. It can work well. since many files should be read, a function is created with the same code. But in the function, fscanf can not work well.
for example, the first line of the the file is: > filename
but the fscanf will give: 207/23/eee/34
it appears... (2 Replies)
Discussion started by: cdbug
2 Replies
2. Programming
# include <stdio.h>
# include <fcntl.h>
# include <stdlib.h>
# include <sys/stat.h>
int main(int argc, char *argv)
{
int fRead, fPadded, padVal;
int btRead;
int BUFFSIZE = 512;
char buff;
if (argc != 4)
{
printf ("Please provide all of the... (3 Replies)
Discussion started by: naranja18she
3 Replies
3. Shell Programming and Scripting
Pls this is emergency.I have written a script which is taking input from another script. and the contents of my second script are acting as functions to my main script.Now the problem is that in one of the functions i want the script ececution to stop and start when user enters any character r... (2 Replies)
Discussion started by: sumitdua
2 Replies
4. UNIX for Dummies Questions & Answers
can u read variables into function in unix
like java or c++ eg
sum($1)
{
if
echo "$1 is equal to yes"
else
echo "$1 not equal to yes"
}
and if so what r the rulz to using function in unix for using functions
thanks in advance :confused: (1 Reply)
Discussion started by: ShinTec
1 Replies
5. UNIX for Dummies Questions & Answers
can you read variables into function in unix
like java or c++ eg
sum($1)
{
if
echo "$1 is equal to yes"
else
echo "$1 not equal to yes"
}
and if so what are the rules to reading variables into function in unix
thanks in advance for your answer (2 Replies)
Discussion started by: ShinTec
2 Replies
6. Shell Programming and Scripting
I'm putting together a script that will search my mail archives for emails that meet certain criteria and output the files to a text file.
I can manually cat that text file and pipe it into sendmail and it will work (i.e. cat /pathtofile/foo.txt | sendmail -t me@company.com)
My script sends... (7 Replies)
Discussion started by: binary-ninja
7 Replies
7. Shell Programming and Scripting
I have trouble getting this logic to work
#!/bin/bash
function assign_var(){
while
do
read -p "$2 :" $3
done
}
assign_var '$IPADDRESS' ipaddress IPADDRESS
Basicly, i want to make sure that entry is made (i can add more sophisticated checks later), but the idea is to recycle... (11 Replies)
Discussion started by: serverchief
11 Replies
8. UNIX Desktop Questions & Answers
dear friends
I have a wrote a shell script which works like this.
1.) a command is executed and the log is moved in the file.
2.) this file is copied in to the other file.
3.) used a grep command to find a particular word.
4.) if a particular word is there then the script will go to next... (4 Replies)
Discussion started by: aboy212u
4 Replies
9. Shell Programming and Scripting
Hi.
How can I create a history function? (By "read" command or so)
&
How can I configure a read command so that the arrow keys are not displayed so funny? (^[[A)
Thanks in advance. (4 Replies)
Discussion started by: sinnlosername
4 Replies
10. Shell Programming and Scripting
I am using while read do/ done to retrieve menu item.
Works as advertised, no problem.
I am using this hack function "pause" to stop script execution and wait for keyboard "enter" key to continue. Sort of break point function. Also works fine with one exception - it does not work when used... (4 Replies)
Discussion started by: annacreek
4 Replies
LEARN ABOUT DEBIAN
coro::socket
Socket(3pm) User Contributed Perl Documentation Socket(3pm)
NAME
Coro::Socket - non-blocking socket-I/O
SYNOPSIS
use Coro::Socket;
# listen on an ipv4 socket
my $socket = new Coro::Socket PeerHost => "localhost",
PeerPort => 'finger';
# listen on any other type of socket
my $socket = Coro::Socket->new_from_fh
(IO::Socket::UNIX->new
Local => "/tmp/socket",
Type => SOCK_STREAM,
);
DESCRIPTION
This module is an AnyEvent user, you need to make sure that you use and run a supported event loop.
This module implements socket-handles in a coroutine-compatible way, that is, other coroutines can run while reads or writes block on the
handle. See Coro::Handle, especially the note about prefering method calls.
IPV6 WARNING
This module was written to imitate the IO::Socket::INET API, and derive from it. Since IO::Socket::INET does not support IPv6, this module
does neither.
Therefore it is not recommended to use Coro::Socket in new code. Instead, use AnyEvent::Socket and Coro::Handle, e.g.:
use Coro;
use Coro::Handle;
use AnyEvent::Socket;
# use tcp_connect from AnyEvent::Socket
# and call Coro::Handle::unblock on it.
tcp_connect "www.google.com", 80, Coro::rouse_cb;
my $fh = unblock +(Coro::rouse_wait)[0];
# now we have a perfectly thread-safe socket handle in $fh
print $fh "GET / HTTP/1.0 15 12 15 12";
local $/;
print <$fh>;
Using "AnyEvent::Socket::tcp_connect" gives you transparent IPv6, multi-homing, SRV-record etc. support.
For listening sockets, use "AnyEvent::Socket::tcp_server".
$fh = new Coro::Socket param => value, ...
Create a new non-blocking tcp handle and connect to the given host and port. The parameter names and values are mostly the same as for
IO::Socket::INET (as ugly as I think they are).
The parameters officially supported currently are: "ReuseAddr", "LocalPort", "LocalHost", "PeerPort", "PeerHost", "Listen", "Timeout",
"SO_RCVBUF", "SO_SNDBUF".
$fh = new Coro::Socket PeerHost => "localhost", PeerPort => 'finger';
AUTHOR
Marc Lehmann <schmorp@schmorp.de>
http://home.schmorp.de/
perl v5.14.2 2012-04-13 Socket(3pm)