How do I make multiple connections to the server in this case


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How do I make multiple connections to the server in this case
# 1  
Old 07-22-2007
How do I make multiple connections to the server in this case

Given the following code
Code:
#!/usr/bin/perl -w
use IO::Socket;

my($handle, $line, $kidpid);
$handle = IO::Socket::INET->new(
                                PeerAddr =>"64.22.229.139",
                                PeerPort =>"4321",
                                Proto=>"tcp",
                                     )
    or die "cant connect to port: $!";

$handle->autoflush(1);
die "can't fork: $!" unless defined($kidpid = fork());

if($kidpid) {
    while(defined($line = <$handle>)){
        print STDOUT $line;
    }
    kill("TERM", $kidpid);
}

else {
    while(defined ($line = <STDIN>)){
        print $handle $line;
    }

}

I want it so it can make two simultaneous connections to the server (instead of one). I thought about maybe using multiple forks(), but I'm at a loss at even how to construct the pseudo code. Ideas?


Thanks in advance
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

See AIX server remote connections

Good morning, Is there any command to view remote conxiones an AIX server? Thank you very much and best regards. (1 Reply)
Discussion started by: systemoper
1 Replies

2. Red Hat

How to Multiple internet connections manage into a single connection.

Dear all, Hope you are all fine & enjoying your good health. Look at this equation 1+1+1=3 So simple I just want to say that I have three internet connections of 1mb, 1mb & 1mb but I can use only 1mb connection at a time & other two connections are useless for me. But now I want to make all... (0 Replies)
Discussion started by: saqlain.bashir
0 Replies

3. UNIX for Dummies Questions & Answers

Samba server guest connections

Hi, I am trying to comprehend Samba's behaviour on one of my Arch systems and thus I'd like to ask a couple of quick questions: The setup I'd like to build is just a small home network for file-sharing using guest connections. Here it goes, 1) When using the following settings for... (4 Replies)
Discussion started by: konos5
4 Replies

4. AIX

connections on server

I am using AIX 5.3, its a application server, i am giving the support of OS & Hardware only, now i want to check how many connections are connected to my server, means how many people using my server.:confused: (4 Replies)
Discussion started by: reply.ravi
4 Replies

5. UNIX for Dummies Questions & Answers

Server has more TIME_WAIT connections in Apache(port 80)

Server has more TIME_WAIT connections in Apache(port 80) Hi, My webserver has 16GB of RAM and CentOS 5.5, Apache 2.2.3, It's shared webserver used of for webhosting. I have optmized the server as : <IfModule prefork.c>... (4 Replies)
Discussion started by: chandranjoy
4 Replies

6. UNIX for Dummies Questions & Answers

How to make URLs/FileNames case insensitive in Linux Hosting environment

Hi, Currently my website is hosted on Linux-Apache environment. If I try to access a file on a website named "Read.txt" as http://xyz.com/READ.txt, I get an error message "Page Not Found". Only way to access is http://xyz.com/Read.txt. How do I make URLS (File Names and Folder Names)... (1 Reply)
Discussion started by: naidu545
1 Replies

7. Shell Programming and Scripting

How to make sed case insensitive

I need to remove a pattern say, ABCD whether it is in uppercase or lowercase from a string. How to do it using SED? for example ABCDEF should output to EF abcdEF should also output to EF (2 Replies)
Discussion started by: vickylife
2 Replies

8. Shell Programming and Scripting

Plink connections to multiple unix servers

Hi, I have a simple windows batch file which connects to a UNIX server and runs a shell script in my home directory on the server. It works perfectly, using plink + ssh keys in the background. What I plan to do is expand this batch file to connect to multiple servers and execute one script... (2 Replies)
Discussion started by: Moxy
2 Replies

9. Shell Programming and Scripting

how to make case insensitive checks????

Hi, I have tried to make the conditions similar to the below one's, perhaps, I am not sure if there are any more way's to do that???? if ) ]] echo "Whatever" fi (5 Replies)
Discussion started by: hitmansilentass
5 Replies

10. UNIX for Advanced & Expert Users

close_wait connections causing a server to hung

Hi Guys, Just wondering if anyone of you have been in a situation where you end up having around 100 close_wait connections and seems to me those connections are locking up resources/processes in the server so unless the server is rebooted those processes won't be released by the close_wait... (3 Replies)
Discussion started by: hariza
3 Replies
Login or Register to Ask a Question
shells(4)							   File Formats 							 shells(4)

NAME
shells - shell database SYNOPSIS
/etc/shells DESCRIPTION
The shells file contains a list of the shells on the system. Applications use this file to determine whether a shell is valid. See getuser- shell(3C). For each shell a single line should be present, consisting of the shell's path, relative to root. A hash mark (#) indicates the beginning of a comment; subsequent characters up to the end of the line are not interpreted by the routines which search the file. Blank lines are also ignored. The following default shells are used by utilities: /bin/bash, /bin/csh, /bin/jsh, /bin/ksh, /bin/pfcsh, /bin/pfksh, /bin/pfsh, /bin/sh, /bin/tcsh, /bin/zsh, /sbin/jsh, /sbin/sh, /usr/bin/bash, /usr/bin/csh, /usr/bin/jsh, /usr/bin/ksh, /usr/bin/pfcsh, /usr/bin/pfksh, /usr/bin/pfsh, and /usr/bin/sh, /usr/bin/tcsh, /usr/bin/zsh. Note that /etc/shells overrides the default list. Invalid shells in /etc/shells may cause unexpected behavior (such as being unable to log in by way of ftp(1)). FILES
/etc/shells lists shells on system SEE ALSO
vipw(1B), ftpd(1M), sendmail(1M), getusershell(3C), aliases(4) SunOS 5.10 4 Jun 2001 shells(4)