File tree Expand file tree Collapse file tree 3 files changed +43
-3
lines changed Expand file tree Collapse file tree 3 files changed +43
-3
lines changed Original file line number Diff line number Diff line change @@ -5,9 +5,16 @@ Records a Vox(A 10 second audio clip) to share with your friends
5
5
6
6
7
7
8
- # UPLOAD .py
8
+ # upload .py
9
9
10
10
Class : TransferData
11
11
methods:
12
12
-> upload_file(local_file, upload_directory)
13
13
-> download_file(download_cloud_directory)
14
+
15
+ # soc_ket.py
16
+
17
+ Class : Exchange
18
+ methods:
19
+ -> Receive(ipaddress for server)
20
+ -> Send(ipaddress of the server ,message)
Original file line number Diff line number Diff line change
1
+ import socket as s
2
+ import sys
3
+ import upload as u
4
+
5
+ class Exchange :
6
+ def receive (self , host = '0.0.0.0' ):
7
+ PORT_NUMBER = 7899
8
+ SIZE = 1024
9
+ try :
10
+ host = s .gethostbyname (host )
11
+ except :
12
+ pass
13
+
14
+ mySocket = s .socket (s .AF_INET , s .SOCK_DGRAM )
15
+ mySocket .bind ((host , PORT_NUMBER ))
16
+
17
+ (data , addr ) = mySocket .recvfrom (SIZE )
18
+ data = data .decode ('utf-8' )
19
+ downloader = u .TransferData ()
20
+ downloader .download_file (data )
21
+
22
+
23
+ def send (self , server , link ):
24
+ SERVER_IP = server
25
+ PORT_NUMBER = 7899
26
+ SIZE = 1024
27
+ print ("Test client sending packets to IP {0}, via port {1}\n " .format (
28
+ SERVER_IP , PORT_NUMBER ))
29
+
30
+ mySocket = s .socket (s .AF_INET , s .SOCK_DGRAM )
31
+
32
+ mySocket .sendto (link .encode ('utf-8' ), (SERVER_IP , PORT_NUMBER ))
33
+
Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ class TransferData:
5
5
def __init__ (self ):
6
6
self .access_token = '4gc0YhoYYVAAAAAAAAAACsHBfiNVDgSKDbtCOnJQRaR77j0rwVuMOoUbCnxSbJJY'
7
7
8
- def __init__ (self , access_token ):
9
- self .access_token = access_token
8
+ # def __init__(self, access_token):
9
+ # self.access_token = access_token
10
10
11
11
def upload_file (self , file_from , file_to ):
12
12
"""upload a file to Dropbox using API v2
You can’t perform that action at this time.
0 commit comments