views:

56

answers:

2

hello ,,, i tried to do client and server and look what i do

#Server
import socket
Host=''
Port=305
OK=socket.socket()
OK.bind((Host,Port))
OK.listn(1)
OK.accept()

and another one for client

#Client 
impot socket 
Host='192.168.1.4' 
Port=305
OK=socket.socket()
OK.connect((Host,Port))

First thing : for now every thing is ok but i want when client connect to server : server print "Hello Admin" in client screen

second thing : i want make like input command ! like

COM=raw_input('enter you command system:')

then client enter dir for example then server print the result in client screen

+1  A: 

When you create a connection, the story isn't over. Now it's time to send data over the connection. Create a simple "protocol" (*) and use it to transfer data from client to server and/or back. One simple example is a textual protocol of commands separated by newlines - this is similar to what HTTP does.

(*) Protocol: an agreement between two parties on the format of their communication.

Eli Bendersky
+1  A: 

Look here, this is a simple echo server written in Python.

http://ilab.cs.byu.edu/python/socket/echoserver.html

ohe
guy i need clear answer with codes i heard about recv and send but i try it but it's not work like !
Str1k3r