For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > June 2005 > require "sys/socket.ph";









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author require "sys/socket.ph";
Gayatri

2005-05-30, 8:56 am

Dear All,

I am facing one problem if any body knows the solution please let me know.



file name : ch.pl..

use Socket;

require "sys/socket.ph"; # for &TCP_NODELAY

socket (SERVER, AF_INET, SOCK_STREAM,0); setsockopt(SERVER, SOL_SOCKET,
&TCP_NODELAY, 1)

or die "Couldn't disable Nagle's algorithm: $!\n";





when the file is compiled, it's throwing error like this..

Scalar found where operator expected at (eval 148) line 1, near "'int'

$__val"

(Missing operator before $__val?)

Undefined subroutine &main::__LONG_MAX__ called at (eval 316) line 1.

Compilation failed in require at

/usr/lib/perl5/5.8.1/i386-linux-thread-multi/sys/socket.ph line 11.

Compilation failed in require at ch.pl line 2.



Thanks in Advance



Thanks & Regards

-Gayatri


***************************NOTE*********
**************************************
Deccanet Designs Ltd is now Flextronics Design Ltd, India
****************************************
**************************************



*************************DISCLAIMER*****
**************************************
This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege of Flextronics Design Ltd.
If you have received this message in error, please notify the originator
immediately. If you are not the intended recipient, you are notified that
you are strictly prohibited from retaining, using, copying, altering or
disclosing the contents of this message.
****************************************
**************************************

John W. Krahn

2005-05-30, 3:55 pm

Gayatri wrote:
> Dear All,


Hello,

> I am facing one problem if any body knows the solution please let me know.
>
>
>
> file name : ch.pl..
>
> use Socket;
>
> require "sys/socket.ph"; # for &TCP_NODELAY

^^^^^^^^^^^^^^^^^^^^^^^^^^

Remove that line and it should work (TCP_NODELAY is included in the Socket
module.)

> socket (SERVER, AF_INET, SOCK_STREAM,0); setsockopt(SERVER, SOL_SOCKET,
> &TCP_NODELAY, 1)
>
> or die "Couldn't disable Nagle's algorithm: $!\n";



John
--
use Perl;
program
fulfillment
Zentara

2005-05-31, 3:57 pm

On Mon, 30 May 2005 16:20:16 +0530, gayatri@deccanetworld.com (Gayatri)
wrote:

>Dear All,
>
> I am facing one problem if any body knows the solution please let me know.


>use Socket;
>
>require "sys/socket.ph"; # for &TCP_NODELAY


Well John Krahn probably gave you the answer, but just in case,
read "man h2ph" and/or "perldoc h2ph".

It explains how you can run the h2ph command to convert
your systems .h files to perls .ph files.



--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
Gayatri

2005-06-02, 8:58 am

Hello John,
Thanks for ur Reply.
But Now I am getting the following error please help if u can.
Thanks in advance


---if i remove require "sys/socket.ph"; line it gives error as

----Undefined subroutine &main::TCP_NODELAY called at
/home/laxmig/Projects/NMD/Testing/SouceCode/modules/frag.pm line 380

----can you please tell me exactly what library path to include for
this error?..

-Gayatri
-----Original Message-----
From: John W. Krahn [mailto:krahnj@telus.net]
Sent: Monday, May 30, 2005 8:06 PM
To: Perl Beginners
Subject: Re: require "sys/socket.ph";

Gayatri wrote:
> Dear All,


Hello,

> I am facing one problem if any body knows the solution please let me

know.
>
>
>
> file name : ch.pl..
>
> use Socket;
>
> require "sys/socket.ph"; # for &TCP_NODELAY

^^^^^^^^^^^^^^^^^^^^^^^^^^

Remove that line and it should work (TCP_NODELAY is included in the Socket
module.)

> socket (SERVER, AF_INET, SOCK_STREAM,0); setsockopt(SERVER, SOL_SOCKET,
> &TCP_NODELAY, 1)
>
> or die "Couldn't disable Nagle's algorithm: $!\n";



John
--
use Perl;
program
fulfillment

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>




***************************NOTE*********
**************************************
Deccanet Designs Ltd is now Flextronics Design Ltd, India
****************************************
**************************************



*************************DISCLAIMER*****
**************************************
This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege of Flextronics Design Ltd.
If you have received this message in error, please notify the originator
immediately. If you are not the intended recipient, you are notified that
you are strictly prohibited from retaining, using, copying, altering or
disclosing the contents of this message.
****************************************
**************************************
John W. Krahn

2005-06-02, 8:58 am

Gayatri wrote:
> Hello John,


Hello,

> Thanks for ur Reply.
> But Now I am getting the following error please help if u can.
> Thanks in advance
>
>
> ---if i remove require "sys/socket.ph"; line it gives error as
>
> ----Undefined subroutine &main::TCP_NODELAY called at
> /home/laxmig/Projects/NMD/Testing/SouceCode/modules/frag.pm line 380
>
> ----can you please tell me exactly what library path to include for
> this error?..


Put this line near the top of your file:

use Socket ':all';



John
--
use Perl;
program
fulfillment
John W. Krahn

2005-06-02, 8:56 pm

Gayatri wrote:
> Sorry to trouble you again but John when I run like that it is giving error
> as follows
>
> "Couldn't disable Nagle's algorithm: Permission denied"
>
> The code is as follows.....
> use Socket ':all';
>
> socket($sock, AF_INET, SOCK_STREAM,$proto)||die "Socket call
> failed";
> setsockopt($sock, SOL_SOCKET, &TCP_NODELAY, 1)
> or die "Couldn't disable Nagle's algorithm: $!\n";
>
> Couldn't disable Nagle's algorithm: Permission denied
>
> does it need to be run under super user privilege??, because when i checked
> with super user it works fine without giving error.
>
> Is it a solution???
>
> Or anyother alternate is there??


This thread on Perl Monks should be helpful:

http://www.perlmonks.com/index.pl?node_id=418728



John
--
use Perl;
program
fulfillment
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com