> I happened to be working on a TCP/IP server when this
> hit my desk
> and having Programming Perl open to the correct page, thought
> I might as
> well quote the "select..." line from the client code...
>
> select ((select(Server), $| = 1)[0];
> print Server "Howdy\n";
> $answer
Kipp, James wrote:
> Hi
> I have simple client/server socket scripts that that send some data
> from the server to the client. It works fine, except the client can't
> seem to read more than 2920 bytes from the server using sysread(). So
> the data I am sending over gets cut off. Here is the releva
On Dec 1, 2003, at 1:27 PM, James Edward Gray II wrote:
On Dec 1, 2003, at 2:36 PM, drieux wrote:
[..]
personally I LOVE andrew gaffney's tighter solution
which I would of course modify minutely to:
while($bytes = sysread(SOCK,$buf,$buf_len)) {
$data .= $buf;
}
There
On Dec 1, 2003, at 3:29 PM, McMahon, Chris wrote:
I happened to be working on a TCP/IP server when this hit my desk
and having Programming Perl open to the correct page, thought I might
as
well quote the "select..." line from the client code...
select ((select(Server), $| = 1)[0];
print Server
dy\n";
$answer = ;
from p 440 of the 3rd edition. Hope that helps, I've done servers
lots more than clients...
-Chris
-Original Message-
From: James Edward Gray II [mailto:[EMAIL PROTECTED]
Sent: Monday, December 01, 2003 1:38 PM
To: Kipp, James
Cc: '[EMAIL PROTECTED]' List
On Dec 1, 2003, at 2:36 PM, drieux wrote:
one way simplistic way to try the sysread() approach
would be go with something like
my $message;
my $bytes=1;
while ($bytes)
{
$bytes = sysread(SOCK,$buf,4096);
$message .= $buf;
#
> one way simplistic way to try the sysread() approach
> would be go with something like
>
> my $message;
>
> my $bytes=1;
> while ($bytes)
> {
> $bytes = sysread(SOCK,$buf,4096);
> $message .= $buf;
> # or try say
>
On Dec 1, 2003, at 12:31 PM, Kipp, James wrote:
Yes, make sense, but not sure how to "check".
Is this where select() comes in?
Let me know if you want to see the entire code I am currently working
with.
p0: USE IO::Select, it will help
especially if you wind up needing
to deal with more than one
> > Yes, make sense, but not sure how to "check". Is this where
> select()
> > comes
> > in?
>
> You got it.
>
> > Let me know if you want to see the entire code I am
> currently working
> > with.
>
> Sure, especially if your client and server are small, post
> away. Tell
> me what you're
Kipp, James wrote:
Thanks. I tried turning off buffering on both ends, that
did not work.
In your example, you only call sysread() once. Is that how you were
doing it? If so, that's the mistake. The one call got you
part of the
data. Then you would loop, check and eventually call again
to
On Dec 1, 2003, at 2:31 PM, Kipp, James wrote:
Thanks. I tried turning off buffering on both ends, that
did not work.
In your example, you only call sysread() once. Is that how you were
doing it? If so, that's the mistake. The one call got you
part of the
data. Then you would loop, check and
On Dec 1, 2003, at 12:18 PM, James Edward Gray II wrote:
[..]
If you can get by with the line oriented reads and writes,
by all means use them and save yourself a lot of pain.
That's rare in networking though, in my experience.
If you really do need sysread(), you'll need to check
it with select()
>
> > Thanks. I tried turning off buffering on both ends, that
> did not work.
>
> In your example, you only call sysread() once. Is that how you were
> doing it? If so, that's the mistake. The one call got you
> part of the
> data. Then you would loop, check and eventually call again
>
On Dec 1, 2003, at 2:25 PM, Kipp, James wrote:
select(), I was afraid somebody would mention that :)
The dreaded select() isn't as scary as it sounds, especially if you use
the IO::Select module. If you like books, Network Programming with
Perl is superb and covers all this well.
Good luck.
J
On Dec 1, 2003, at 2:25 PM, Kipp, James wrote:
Yes. Calling sysread() gets you what's ready to be read UP TO the
amount of data you specify. The rest probably just wasn't available
yet. There could be a lot of reasons for this: network lag,
operating
system buffers, etc.
Thanks. I tried turnin
>> Yes. Calling sysread() gets you what's ready to be read UP TO the
> amount of data you specify. The rest probably just wasn't available
> yet. There could be a lot of reasons for this: network lag,
> operating
> system buffers, etc.
Thanks. I tried turning off buffering on both ends, t
On Dec 1, 2003, at 2:02 PM, Kipp, James wrote:
Hi
I have simple client/server socket scripts that that send some data
from the
server to the client. It works fine, except the client can't seem to
read
more than 2920 bytes from the server using sysread(). So the data I am
sending over gets cut of
17 matches
Mail list logo