package universityPB; import java.io.IOException; import java.net.Socket; public class Client { public static void main(String[] args) throws IOException { Socket s = new Socket("localhost", 9999); StudentOuterClass.Student student = StudentOuterClass.Student.newBuilder() .setName("John") .setSurname("Cena") .setYob(1977) .setResidence(StudentOuterClass.Student.PlaceOfResidence.newBuilder() .setStreet("Via Celoria") .setNumber(18) .setCity("Milano")) .addExam(StudentOuterClass.Student.Exam.newBuilder() .setName("SDP") .setMark(30) .setDate("31/05/2024")) .build(); System.out.println("Bytes: " + student.toByteArray().length); student.writeTo(s.getOutputStream()); s.close(); } }