Programming

jeudi 22 juin 2023, 19:39  #1
TCP - Back to school (It should work but it doesnt)
Gatix
  • 1 posts

I’ve got some code for "TCP - Back to school" challenge, and it should work because i calculate everything correctly and send the server back the response. But i don’t recieve nothing back from the server.
For example when the server sends me : "Calculate the square root of 761 and multiply by 3920 =", i send the server "108138.02" within 2 seconds, so it should work, but it doesn’t. I tried also sending it as an int 108138, but
it didn’t work. Why i don’t recieve any message from the server after sending the response ?

jeudi 29 juin 2023, 17:30  #2
TCP - Back to school (It should work but it doesnt)
Eidolon
  • 1 posts

Did you fully emulate a user’s response ?

lundi 17 juillet 2023, 06:00  #3
TCP - Back to school (It should work but it doesnt)
isehsnap
  • 1 posts

i have the same.. The second time i try to recieve something from the socket nothing gets sent it is just waiting forever
What do you mean by "fully emulate a user’s response" ?

jeudi 27 juillet 2023, 16:01  #4
TCP - Back to school (It should work but it doesnt)
pin0pinguino
  • 1 posts

You can try to add terminator string characters and send message to server : s.send((password + "\r\n").encode())
After this you can receive new messages from server, for example : s.recv(4096)

vendredi 28 juillet 2023, 10:35  #5
TCP - Back to school (It should work but it doesnt)
hoangmay
  • 1 posts

i dont know how to start. i click the link and the new web does not do not thing . have i to code in some where like visual studio code or something. i just start a first changlle here . i need some help

mercredi 23 août 2023, 07:24  #6
TCP - Back to school (It should work but it doesnt)
louis.la3
  • 43 posts

You can’t publish challenge solutions like that ! You risk getting banned !

samedi 26 août 2023, 12:10  #7
TCP - Back to school (It should work but it doesnt)
Th1b4ud
  • 1636 posts

Hello @Tetrospectiva,

As stipulated in the rules of root-me, it is strictly forbidden to divulge the answers of the challenges. As a result, your account will be automatically banned in 7 days (i.e. Saturday, September 2 at 12:00 p.m.). Deleting all solutions interrupts the banishment. Thanks.

samedi 14 octobre 2023, 16:26  #8
TCP - Back to school (It should work but it doesnt)
HadiM
  • 2 posts

I built this code but it still does not work I am getting empty final massage , even tho it tells me its wrong answer even tho its not wrong

import socket
import time

def communicate_with_server() :
# Define the server’s IP address and port
server_ip = ’challenge01.root-me.org’
server_port = 52002

# Create a socket object
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

try :
# Set a timeout value (e.g., 10 seconds)
client_socket.settimeout(10.0)

# Connect to the server
client_socket.connect((server_ip, server_port))
print(f"Connected to server_ip :server_port")

# Receive the initial message from the server
initial_message = client_socket.recv(1024).decode(’utf-8’)
print(f"Received initial message : initial_message")

# Extract numbers from the initial message
numbers = [float(num) for num in initial_message.split() if num.replace(’.’, ’’, 1).isdigit()]
print(f"Extracted numbers : numbers")

# Record the start time
start_time = time.time()

# Perform the specified calculation
result = round((numbers[1]**0.5 * numbers[2]) / 2, 2)
integer_result = int(result)
print(f"Calculated result : result")

# Send the result to the server immediately
client_socket.sendall(str(integer_result).encode(’utf-8’) b’n’) # Sending integer part as a string
print(f"Sent result to the server : integer_result")

# Wait for the server’s response
response = client_socket.recv(1024).decode(’utf-8’)
print(f"Received response : response")

# Record the end time
end_time = time.time()

# Calculate the elapsed time
elapsed_time = end_time - start_time
print(f"Elapsed time : elapsed_time seconds")

# Adjust the timing threshold based on your observations
timing_threshold = 2.5 # Set a value slightly higher than the expected time
if elapsed_time > timing_threshold :
print("Warning : Elapsed time exceeded the expected threshold.")

# Send the result back to the server
client_socket.sendall(str(integer_result).encode(’utf-8’) b’n’) # Sending integer part as a string
print(f"Sent result back to server : integer_result")

# Wait for the final response from the server
final_response = client_socket.recv(1024).decode(’utf-8’)
print(f"Received final response : repr(final_response)", flush=True)

except socket.timeout :
print("Timeout : No response from the server within the specified time.")

except Exception as e :
print(f"Error : e")

finally :
# Close the socket connection
client_socket.close()
print("Connection closed")

# Call the function to run the communication
communicate_with_server()

mardi 23 juillet 2024, 15:01  #9
TCP - Back to school (It should work but it doesnt)
crc
crc
  • 2 posts

I also have a slightly similar code, calculating and sending back to server under 2 secs, but my issue is that I am not receiving any answer from server after sending result as integer n form of binary data. somebody some hint ?

jeudi 25 juillet 2024, 08:26  #10
TCP - Back to school (It should work but it doesnt)
Wross
  • 1 posts

I completely understand where you’re coming from. Sometimes even after breaking it down, it can still be confusing. I found that seeking external help can make a huge difference. For instance, I used MyAssignmentHelp.co.uk for economics assignment help, and it was a game-changer. They have experts who can guide you through the complex theories and calculations.

mercredi 30 octobre 2024, 09:34  #11
TCP - Back to school (It should work but it doesnt)
bekeanloise
  • 3 posts

With its retro visuals and easy-to-pick-up gameplay, Retro Bowl College is a delightful throwback to classic football games, offering a fresh take on college sports.