Giter Site home page Giter Site logo

file_transfer's Introduction

Untitled-2

file_transfer

Python Network Programming - Basic Server

File transfer is the process of copying or moving a file from a computer to another over a network or Internet connection.

The basic idea is to create a server that listens on a particular port, this server will be responsible for receiving files (you can make the server sends files as well). On the other hand, the client will try to connect to the server and send a file of any type.

We are going to use socket module which comes built-in with Python and provides us with socket operations that are widely used on the Internet, as they are behind of any connection to any network.

Output on a local server:

    Server listening....
    Got connection from ('192.168.56.10', 62854)
    ('Server received', "'Hello server!'")
    ('Sent ', "'1 1234567890\\n
    ...
    ('Sent ', "'4567890\\n105
    ...
    ('Sent ', "'300 1234567890\\n'")
    Done sending

Output on a local client:

     file opened
    receiving data...
    data=1 1234567890
    2 1234567890
    ...
    103 1234567890
    104 123
    receiving data...
    data=4567890
    105 1234567890
    106 1234567890
    ...
    299 1234567890

    receiving data...
    data=300 1234567890
    Thank you for connecting
    receiving data...
    data=
    Successfully get the file
    connection closed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.