|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to detect my current network status on TCP/IP (online or offline) using perl?
Thank you in advance. |
|
#2
|
||||
|
||||
|
This depends on how you connect and what OS you are using. I can't comment on windows.
On *nix, I use crontab to run a script every 5 minutes on my linux box. The script uses backticks to run "ifconfig," which will tell you mucho information about what network connections you have running. I then parse this script to figure out my IP address. This is for my ADSL account, which ocassionally "loses it's lease" and the IP changes. When the change occurs, I have it email me so I can still SSH to my box and get my IP matched to my DNS service again, and keep my web server running smoothly. Works pretty well. . . You could probably write something to work similarly for windows too. . . |
|
#3
|
|||
|
|||
|
I'm writing my own SMTP-server on Perl and want this one:
If there's no TCP/IP connection, my server won't try to send any of messages. But how to detect it? I want to detect it without connecting to any server. |
|
#4
|
||||
|
||||
|
Why? Why write your own SMTP server, when this wheel has been invented a million different times? Do you really think what you'll write could be better and more standards-compliant than sendmail?
Are you saying you want to make a program that interfaces with an SMTP server? That would make more sense. What's wrong with a periodic ping to a web page, like yahoo? If you ping fails, you'll know you don't have TCP/IP connectivity. You should really look into "ifconfig" if you want to read your network interfaces directly. I'm sure someone has written something on CPAN too. |
|
#5
|
|||
|
|||
|
Ok. Listen.
I do it 'cause need it. It won't be sendmail-like program. It will be a real localhost SMTP-server for Windows. I don't want to ping some server. Because the server may be switched off or no ping or something else. I want to enable the mechanism used in ICQ Net Detect. You talk about ifconfig, but I use Windows. If you can't give a full answer on my question, close your mouth, please. |
|
#6
|
||||
|
||||
|
I'm sorry. You didn't indicate you were using windows until your last post.
Good Luck! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Net Detection |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|