Use Python For Socket Programming To Connect Two or More PCs To Share A Text File. | I'M FROSTY

HTML Image

IMFROSTY

Whats Hot ?

This Domain Name is for Sale !! Please contact Admin : pandyanhardik@gmail.com, If you are interested to buy it..

Use Python For Socket Programming To Connect Two or More PCs To Share A Text File.

========= To server.py File =======
 #!/usr/bin/python           # This is server.py file

import socket                # Import socket module
import sys

s = socket.socket()          # Create a socket object
host = '192.168.2.232'
port = 4444                  # Reserve a port for your service.
s.bind((host, port))         # Bind to the port

s.listen(5)                  #Now wait for client connection.
fileToSend = open("ToSend.txt","r")
content = fileToSend.read()
while True:
c, addr = s.accept()         # Establish connection with client.
print 'Got connection from', addr
c.sendall(content)
c.close()                    # Close the connection
fileToSend.close()
============ To File.txt File ============
HELLO.....
============ OUTPUT ============
[hnpandya@localhost ~]$ python server.py
Got connection from ('192.168.2.233', 40628).
Use Python For Socket Programming To Connect Two or More PCs To Share A Text File. Reviewed by Hardik Pandya on 1:09:00 PM Rating: 5

No comments:

All Rights Reserved by I'M FROSTY © 2014 - 2017
*The Content Is Copyrighted To & May Not Be Copied / Republished.

Biểu mẫu liên hệ

Name

Email *

Message *

Powered by Blogger.