首页 > 代码库 > java socket

java socket

import java.net.ServerSocketimport java.io.OutputStreamWriterimport java.io.BufferedWriterval listener = new ServerSocket(15209)val server = listener.acceptval osServ = server.getOutputStreamval writer = new BufferedWriter(new OutputStreamWriter(osServ))writer.write("adsf\n")writer.flushimport java.net.Socket import java.io.InputStreamReaderimport java.io.BufferedReaderval skt = new Socket("10.237.62.52", 15209)val isc = skt.getInputStreamval reader = new BufferedReader(new InputStreamReader(isc))reader.readLine

 

java socket