Posts

Showing posts from December, 2019

GroupChat: Chat and File Transfer

08:55  PM This is getting more and more fun!! After initially establishing a connection between two computers, and having every user view names of all other connected users, I thought of moving towards file transfer. In between that, I had to make quite a few rounds between two laptops to run the changes. But Kudos to @Govind for suggesting ssh! With ssh you can access any other computer in your network, via your own computer. So I only need to run some linux commands to copy the file in other computer and run it there. So, I first established da connection via UDP sockets between two different computers. Then, whenever a user wishes to transfer a file to another user, he just needs to click on the user name, and he gets a file picker box. After picking the file, the file begins to get transferred to the destination over a TCP reliable connection. The user also gets visual cue about the amount of file transferred and speed at which file transfer is happening.  ...

GroupChat Developments

12:05 PM So, I was able to achieve a successful communication between two computers connected over the same wifi network using python sockets. One of the problems that I encountered was that it kept dropping some packets which I sent for reasons I don't know. Still, long way to go.. Here is the code.. from socket import * import threading import json import sys def keep_recieving ( s ): while True : m = s.recvfrom( 54545 ) incoming_json = json.loads(m[ 0 ]) print ( ' \r ' ) if incoming_json[ 'type' ] == 'connect' : print (incoming_json[ 'name' ] + ' Joined' ) elif incoming_json[ 'type' ] == 'message' : if name == incoming_json[ 'from' ]: #print('You: '+incoming_json['message']) pass else : print (incoming_json[ 'f...