Question
Exercise Topic: Communicate with the server through the network, and count the number of occurrences of keywords in the RFC3261.txt file. (Keywords are provided by
Exercise
Topic: Communicate with the server through the network, and count the number of occurrences of keywords in the RFC3261.txt file.
(Keywords are provided by the server, and the RFC3261.txt file is downloaded from the Internet. Please upload the answer to the server)
1. Preparations:
Add the import file, #include TCPIP_Sync.cpp
Use TCP, Server Port=7000, IP=140.113.170.78 to connect to the server
2. Steps:
a. Start_TCP_Client(&Sock,Port,IP);
b. Send(Sock, "REGISTER/Name/your number ", 0);
c. Receive "Registration Successful/KeyWord" in Thread Function
Keyword is the word we want to find
d. Find the occurrences of KeyWord 1, 2, 3, 4 in the RFC3261.txt file
e. Send the answer back to the server in the following format
sprintf(S1,"ANSWER/%d/%d/%d/%d", times 1, times 2, times 3, times 4);
send(Sock,S1,strlen(S1),0);
f. Receive response results.
3. Definition of number 1: *KeyWord* and case-insensitive
Definition of number 2: *KeyWord* and case must be distinguished
Definition of number 3: Independent KeyWord and case-insensitive, including KeyWord
Definition of number 4: independent KeyWord and case-sensitive, including KeyWord
Hint. Use fread() for times 1 and 2, and fscanf() for times 3 and 4
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started