Java sockets: DataOutputStream or OutputStream?

后端 未结 3 2145
慢半拍i
慢半拍i 2021-02-07 08:11

I\'m still relatively new to sockets, and I haven\'t seen any information regarding this subject.

To write to a connected socket, you can either use

sock         


        
3条回答
  •  难免孤独
    2021-02-07 08:17

    Just now I came to know a difference between dataoutputstream and outputstreamwriter while working with a SOAP services... I tried to pass arabic data through request XML but in the response XML I'm getting some junk characters in place of arabic data then I tried to encode (UTF-8) the request but there is no such method to encode in DataOutputStream where as you can encode the request in OutputStreamWriter before sending the request. OutputStreamWriter out = new OutputStreamWriter(con.getOutputStream(), "UTF-8"); out.write(inputXML);

提交回复
热议问题