diff options
| author | jerome <jerome@xlinfo.fr> | 2023-12-18 00:02:09 +0100 |
|---|---|---|
| committer | jerome <jerome@xlinfo.fr> | 2023-12-18 00:02:09 +0100 |
| commit | a1203ccb343703ba5ae522254f75b6384a1831a7 (patch) | |
| tree | c54e1e6cf0da29170419b2fd9880ff6dcea28742 /connect.py | |
| download | python-a1203ccb343703ba5ae522254f75b6384a1831a7.tar.gz python-a1203ccb343703ba5ae522254f75b6384a1831a7.zip | |
depôt initial
Diffstat (limited to 'connect.py')
| -rw-r--r-- | connect.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/connect.py b/connect.py new file mode 100644 index 0000000..858d82f --- /dev/null +++ b/connect.py @@ -0,0 +1,14 @@ +import sys +host=sys.argv[1] +port=int(sys.argv[2]) + +import socket +s=socket.socket(socket.AF_INET, socket.SOCK_STREAM) +addr_server=(host,port) +tentative=s.connect_ex(addr_server) #connect_ex renvoie 0 en cas de succès... +if tentative==0: + print("port 80 ouvert") +else: + print("Echec de connexion") +s.close() + |
