Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with a CLIENT command
#1
Hello,first of all I want to say that I am very new to python and don't know much.Also English is not my native/mother tongue,but I will try my best to type as clearly as I can.
I need help with the following code and how to make my IF statement execute that command if the message recieved is "python"
import socket
import sys
import time

s = socket.socket()
host = input(str("Enter Server Hostname : "))
port = 27312
s.connect((host,port))
print(" Connected to chat server")
while 1:
            incoming_message = s.recv(1024)
            incoming_message = incoming_message.decode()
            print(" Server : ", incoming_message)
			if incoming_message = "python":
			python -m webbrowser -t "http://www.python.org"
			return
            print("")
            message = input(str(">> "))
            message = message.encode()
            s.send(message)
            print("message has been sent...")
            print("")
Reply


Messages In This Thread
Help with a CLIENT command - by monstervoid - Nov-12-2018, 09:12 PM
RE: Help with a CLIENT command - by Larz60+ - Nov-12-2018, 11:30 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020