Write a program that shows the operation of TCP/IP socket. You are allowed to use any programming language. You have to submit your code with a screenshot of the result after running the code. Useful links: https://www.javaworld.com/article/2077322/core-java-sockets-programming-in-java-atutorial.html https://www.c-sharpcorner.com/article/socket-programming-in-cpp-using-boost-asio-tcpserver-and-client/
TO TRANSFER MESSAGE
Client_d.py
import sys from socket import socket, AF_INET, SOCK_DGRAM # simply put the I.P address of computer you want to send message # in this i had shown put the localhost SERVER_IP = 'localhost' # change the port number if you want # but change at both client and server PORT_NUM = 5000 SIZE = 2048 print("Client sending packets \n".format(SERVER_IP, PORT_NUM)) myMessage1 = "" mySocket = socket(AF_INET, SOCK_DGRAM) i = 0 # server closes if you type Exit # else client can send message as long as he wants while myMessage1 != str('Exit'): myMessage1 = input() # encoding the message mySocket.sendto(myMessage1.encode('utf-8'), (SERVER_IP, PORT_NUM)) sys.exit()
server_d.py
from socket import socket, gethostbyname, AF_INET, SOCK_DGRAM # port number over which transfer takes place PORT_NUM = 5000 # message size should be smaller than this SIZE = 2048 hostName = gethostbyname('0.0.0.0') mySocket = socket(AF_INET, SOCK_DGRAM) mySocket.bind((hostName, PORT_NUM)) print("Listening on port {0}\n".format(PORT_NUM)) # Listens unless client send exit message while True: (data, addr) = mySocket.recvfrom(SIZE) # decoding receiving message print(data.decode()) sys.exit()
TO TRANSFER FILES
Client.py
import socket s = socket.socket() # enter the server IP address and port number over which you are sending file # cannot be localhost as we cannot send file to our own system s.connect(("192.168.43.136", 1111)) # type the name of file f = open("life_hack.mp4", "rb") l = f.read(2048) while l: s.send(l) l = f.read(2048) s.close()
server.py
import socket import sys s = socket.socket() s.bind(("0.0.0.0", 1111)) s.listen(10) i = 1 while True: sc, address = s.accept() print(address) # extension should be known before hand i.e., which type of file client is going to send f = open('file_' + str(i) + ".mp4", 'wb') i = i + 1 while True: l = sc.recv(2048) f.write(l) if not l: break f.close() sc.close() print('File copied.') s.close()
Write a program that shows the operation of TCP/IP socket. You are allowed to use any...
Write a program that shows the operation of TCP/IP socket. (Java) Please if you can, put a comment to let me understand the code better.
Write technical report about the socket programming which should include the followng: Introduction about the socket programming Advantages of socket programming Create TCP/IP Client (the source code in any language) socket program that performs the following steps: a. Initializes Winsock. b. Creates a socket. c. Connects to the server. d. Sends and receives data. e. Disconnects. create TCP/IP Server socket program that performs the following steps: a. Initializes Winsock. b. Creates a socket. c. Listen for client. d. Receives and...
implement the follwing code using command promp or Eclipse or any other program you are familiar with. keep the name of the classes exatcly the same as requested for testing purpose. please follow each instruction provided below Objective of this assignment o get you famililar with developing and implementing TCP or UDP sockets. What you need to do: I. Implement a simple TCP Client-Server application 2. and analyze round trip time measurements for each of the above applications 3. The...
You are to write a Java program using the following instructions to build a bank-ATM server system with sockets. A bank holds accounts that can have deposits, withdrawals, or retrievals of balance. The bank server provides the account for transactions when a client uses and ATM machine. The ATM asks for the type of transaction and the amount (if needed), then creates a socket connection to the bank to send the transaction for processing. The bank performs the transaction on...
In this programming project you are required to develop a 16-bit CRC program using Java and test your program with the crctest.txt file. The corresponding 16-bit CRC should be attached to the end of each line. You are asked to use a 16-bit polynomial - x^16+x^12+x^5+1. You are allowed to use the Java 16-bit CRC library - java.io* & java.util.zip.CRC, but your max points will be 20/25. The contents inside the crctest.txt file include: Computer Science! Fall Foliage around Poconos...
Write a software key-logger and test it while you fill out a web form or type in the contents of a document using your favorite document preparation software. You can use Java or Python to do this assignment. C and C related programming language is not allowed for this assignment. Hints: You can find a demo and API for key-logger hook in the following link for JAVA. https://github.com/kwhat/jnativehook This project can only be used to learn how to use JNI...
Background: For this assignment, you will write a small encryption utility that implements a simple encryption algorithm described below. The program will take one command line argument as an input; this will represent the word which is to be encrypted. As an output, your program will print the encrypted version of the word to the console using a simple printf() statement. This is the only output your program needs to produce. There is an important catch, however: your program is...
C++ please Project: Working with Text Write an object-oriented program the performs the following tasks: . Reads a text file provided along with this data and maintains it an object. Determines the number of characters and keeps in the object. Determines the number of words and retains the result in the object. Determines the number of paragraphs and keeps the result in the object. A possible class definition: class Textutil { string text = ** int words = @; int...
//I NEED THE PROGRAM IN C LANGUAGE!// QUESTION: I need you to write a program which manipulates text from an input file using the string library. Your program will accept command line arguments for the input and output file names as well as a list of blacklisted words. There are two major features in this programming: 1. Given an input file with text and a list of words, find and replace every use of these blacklisted words with the string...