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...
I NEED HELP WITH NETWORKS ( 1 - 11) QUESTIONS , ENSURE YOU ANSWER THEM ALL QUESTION 1 Which of the following could be valid DNS resource record entries? (mysite.com, 125.245.206.3, NS) (ibm.com, backup6.ibm.com, CNAME) (158.223.21.2, mypage.edu, A) All of the above None of the above 1 points QUESTION 2 Which mail protocol keeps state information across sessions? SMTP POP3 IMAP All of the above None of the above 1 points QUESTION 3 What type of message is...
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...
How do i write the pseudocode for this java code? First, write
out pseudocode, and then create a program to help you by
accomplishing the following tasks:
: Use command line interface to ask the user to input the
following.
○ How many apples are on hand ○ How many apples should be in
stock ○ How many oranges are on hand ○ How many oranges should be
in stock
Perform an operation to determine how many of...