perl socket


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting perl socket
# 1  
Old 03-03-2009
perl socket

Hello there:
What is default value of listen if I, avoid init it on constructor. I need maximum num for Listen. I want to write a daemon thus i need unlimited listen.

Code:
my $sock = IO::Socket::INET->new( Listen    => 20,
LocalPort => $port,
Reuse     => 1)

Thanks in advance.
# 2  
Old 03-03-2009
AFAIK, the Listen option only defines the listen queue, eg. the maximum number of concurrent connection tries. As soon as your program accept()s a connection one of these slots gets freed.
And I'd suggest not allowing unlimited connections for your daemon as this might kill your system if too many resources are used.
# 3  
Old 03-03-2009
From perlipc:

Listen

The Listen parameter is set to the maximum number of pending connections we can accept until we turn away incoming clients. Think of it as a call-waiting queue for your telephone. The low-level Socket module has a special symbol for the system maximum, which is SOMAXCONN.
# 4  
Old 03-04-2009
Mr Pludi and Kevin, Thanks a lot.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[PERL] Check if socket is connected before sending data

Hello community, I'm programming a simple code using socket connection in perl: $sock = new IO::Socket::INET( PeerAddr => '192.168.10.7', PeerPort => 8000, Proto => 'tcp'); $sock or die "no socket :$!";Then sending data using a loop: ... (1 Reply)
Discussion started by: Lord Spectre
1 Replies

2. Shell Programming and Scripting

Socket Programming in Perl

Hi All I am getting an error when using the below code Receiver use IO::Socket; $sock = new IO::Socket::INET (LocalHost => 'goldengate', LocalPort => 1200, Proto => 'tcp', Listen => 5, Reuse => 1 ); die "Socket could not be created. Reason: $!" unless $sock; while ($new_sock =... (5 Replies)
Discussion started by: parthmittal2007
5 Replies

3. IP Networking

Clarification - Setting socket options at the same time when socket is listening

I need clarification on whether it is okay to set socket options on a listening socket simultaneously when it is being used in an accept() call? Following is the scenario:- -- Task 1 - is executing in a loop - polling a listen socket, lets call it 'fd', (whose file descriptor is global)... (2 Replies)
Discussion started by: jake24
2 Replies

4. Programming

perl socket issue

Hi I am teaching myself perl and am writing a socket application to get experience. I am using Eclipse with the EPIC plugin to run the code in debug mode. I think that sometimes the script is not releasing the port if I terminate it in debug mode as I am occasionally getting the message: - ... (3 Replies)
Discussion started by: steadyonabix
3 Replies

5. Programming

Error with socket operation on non-socket

Dear Experts, i am compiling my code in suse 4.1 which is compiling fine, but at runtime it is showing me for socket programming error no 88 as i searched in errno.h it is telling me socket operation on non socket, what is the meaning of this , how to deal with this error , please... (1 Reply)
Discussion started by: vin_pll
1 Replies

6. Programming

socket function to read a webpage (socket.h)

Why does this socket function only read the first 1440 chars of the stream. Why not the whole stream ? I checked it with gdm and valgrind and everything seems correct... #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <string.h> #include... (3 Replies)
Discussion started by: cyler
3 Replies

7. Shell Programming and Scripting

Perl socket question

Hi there, Really quick question that I have been unable to find an answer for on the web is simply, can use the newer IO::Socket module on my sever process and use the older perl built-in "socket" module to connect to the IO:socket? or do i need to have the same module (be it socket or... (1 Reply)
Discussion started by: rethink
1 Replies

8. Programming

which socket should socket option on be set

Hi all, On the server side, one socket is used for listening, the others are used for communicating with the client. My question is: if i want to set option for socket, which socket should be set on? If either can be set, what's the different? Again, what's the different if set option... (1 Reply)
Discussion started by: blademan100
1 Replies

9. UNIX for Advanced & Expert Users

connect problem for sctp socket (ipv6 socket) - Runtime fail Invalid Arguments

Hi, I was porting ipv4 application to ipv6; i was done with TCP transports. Now i am facing problem with SCTp transport at runtime. To test SCTP transport I am using following server and client socket programs. Server program runs fine, but client program fails giving Invalid Arguments for... (0 Replies)
Discussion started by: chandrutiptur
0 Replies

10. Shell Programming and Scripting

simple socket programming in perl

hi i want to write simple socket program which will listen on socket . here is the code ## read msg on socket #! /usr/bin/perl use IO::Socket::INET; my $MySocket= IO::Socket::INET->new(LocalPort=>1234, Proto=>'udp') ; while ()... (2 Replies)
Discussion started by: zedex
2 Replies
Login or Register to Ask a Question