Java client python server socket programming

前端 未结 5 1429
花落未央
花落未央 2021-02-06 19:38

I have a client program in java that sends a message \"Hello\" to python server.

Java code

    import java.io.*;  
    import java.net.*; 
    public cla         


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-06 20:26

    because the string you get on the server side has 2 hidden characters at the beginning, so you must remove these 2 characters before comparing it.

    if ( msg[2:] == "Hello" ):
    

提交回复
热议问题