Code Room
Code reviewMediumcr-g598
Subject Tls socket no shutdownLevel Mid–Senior~18 minCommon in Networking & APIs interviewsIndustries Software development, Telecom

Question

Review this Rust function that talks to a service over a TCP stream.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewrust
use std::net::TcpStream;use std::io::{Write, Read}; fn rpc(req: &[u8]) -> std::io::Result<Vec<u8>> {    let mut s = TcpStream::connect("svc.internal:9000")?;    s.write_all(req)?;    let mut buf = Vec::new();    s.read_to_end(&mut buf)?;    Ok(buf)}
Run or narrate your approach, then ask the coach.