shekarkcb has asked for the wisdom of the Perl Monks concerning the following question:
Sorry to reposting the similar question.
I was going through socket programing, got a doubt, what is the difference between udp client and server?
Suppose if i need to listen in my machine for a perticular port (40150 - which will have x amounts of udp packets coming in from a server - direct push) how can i code this on Perl?
i have written this code
# $IP will have the actual ip from where packets are coming in system(" tcpdump -v -i eth1 dst $IP > file.txt & "); my $GREP=`ps aux | grep 'tcpdump ' | grep -v grep | awk '{pri +nt \$2}'`; chomp($GREP); print "PID for |$IP| IS -->|$GREP|\n"; print "SLEEEPING FOR 5 seconds....\n"; sleep(5); chomp($GREP); print "KILLING PROCESS ID ------->|$GREP|\n"; system("kill -9 $GREP"); my $LINES=`wc -l $path\/file.txt | awk '{ print \$1}'`; chomp($LINES); if($LINES > 5) { # I have ip coming in } else { # Looks like ip with udp packets is not coming in } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: What is the difference between udp client and server?
by locked_user sundialsvc4 (Abbot) on Nov 10, 2010 at 13:35 UTC | |
|
Re: What is the difference between udp client and server?
by chrestomanci (Priest) on Nov 10, 2010 at 09:17 UTC | |
by ikegami (Patriarch) on Nov 10, 2010 at 16:31 UTC | |
|
Re: What is the difference between udp client and server?
by JavaFan (Canon) on Nov 10, 2010 at 15:33 UTC | |
|
Re: What is the difference between udp client and server?
by andal (Hermit) on Nov 10, 2010 at 09:21 UTC |