Skip to content

Commit 720a84c

Browse files
committed
FTP file transfer study
A comparative File transfer study over using using Socket Programming (ftplib and pyftpdlib) and FileZilla like applications.
1 parent 8683481 commit 720a84c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+307
-0
lines changed
15.7 KB
262 KB
5.81 KB
Binary file not shown.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from socket import *
2+
# enables to create sockets
3+
serv_addr = "192.168.1.15"
4+
# IP address of the sever
5+
serv_port = 8000
6+
# Port number of the server is given a 16 bit number
7+
client_sock = socket(AF_INET,SOCK_STREAM)
8+
#The client's socket is created, it will generate a random 16 bit number. First parameter indicates that the underlying network is IPv4, 2nd parameter indicated that it is a TCP socket
9+
client_sock.connect((serv_addr,serv_port))
10+
#The client establishes a TCP connection between the client and server before sending data to the server
11+
msg = input("Enter the text message")
12+
#The client will be asked to input a line until the user ends the line by a carriage return
13+
client_sock.send(msg.encode())
14+
#Sends the encoded string msg through the client's socket, into the TCP connection.
15+
mod_msg = client_sock.recv(2048)
16+
#When characters arrive from the server, they get placed into the string mod_msg.
17+
print("From Server:", mod_msg.decode())
18+
#The message placed in the mod_msg variable is decoded.
19+
client_sock.close()
20+
#Closes the socket, hence closes the TCP connection between the client and the server
Binary file not shown.
Binary file not shown.
40.4 KB
301 KB
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from socket import *
2+
serv_addr = "192.168.1.15"
3+
serv_port = 8000
4+
serv_sock = socket(AF_INET,SOCK_STREAM)
5+
serv_sock.bind((serv_addr,serv_port))
6+
serv_sock.listen(1)
7+
print("The server is ready to receive")
8+
while 1:
9+
conn_sock,client_addr = serv_sock.accept()
10+
print("Got connection from", client_addr)
11+
# print("message",conn_sock)
12+
msg = conn_sock.recv(2048)
13+
# print("message",msg)
14+
print(msg.decode())
15+
mod_msg = msg.upper()
16+
conn_sock.send(mod_msg)
17+
conn_sock.close()

02 File Transfer/FTP/Client/abc.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dependent certainty off discovery him his tolerably offending. Ham for attention remainder sometimes additions recommend fat our. Direction has strangers now believing. Respect enjoyed gay far exposed parlors towards. Enjoyment use tolerably dependent listening men. No peculiar in handsome together unlocked do by. Article concern joy anxious did picture sir her. Although desirous not recurred disposed off shy you numerous securing.

0 commit comments

Comments
 (0)