Ascii on TCP socket

后端 未结 3 1520
孤独总比滥情好
孤独总比滥情好 2021-01-14 08:39

Anyone could pass me an example of sending Ascii msg over TCP?(couldnt find example on the net)

thanks,

ray.

3条回答
  •  醉话见心
    2021-01-14 09:10

    Not sure, I think this should work:

    try (DataOutputStream outToClient = new DataOutputStream(socket.getOutputStream())) {
        outToClient.write(stringMessage.getBytes("US-ASCII"));
    } catch (IOException e) {}
    

提交回复
热议问题