Socket programming

pramod gowda pramod.sp78 at gmail.com
Sat Jan 3 12:43:18 CET 2015


Hi i am learning socket programming,

client code:

import socket

client_socket=socket.socket()
server_address='192.168.2.2'
server_port= 80
print("hello")
client_socket.connect((server_address,server_port))
print("hello")
data=client_socket.recv(1024)
print(data)
client_socket.close()

server code:
import socket

server_socket=socket.socket()
server_name='192.168.2.2'
server_port= 80
server_socket.bind((server_name,server_port))
server_socket.listen(1)

while True:
    print("hello")
    c,address=server_socket.accept()
    print("we got connection from:",address)
    c.send("hello,hw ru")
    c.close()




I am not getting the output, i am using windows 7 OS..
please  check and give me the solution.



More information about the Python-list mailing list