Đã Hủy

Java Socket Write/Read

Small, but urgent project to fix the following code. It needs to write-to and then listen-and-read-from a socket:-

// Java Imports

...

...

...

// the data to write to the socket

String bytes_to_send_to_socket = new String(bytes);

// Must terminate socket write with null

String byte_to_terminate)socket = [url removed, login to view]('\0');

// socket address/port

String serverName = "[url removed, login to view]";

int port = 34003;

// open socket

Socket client = new Socket(serverName, port);

// Write to Socket

OutputStream outToServer = [url removed, login to view]();

[url removed, login to view]([url removed, login to view]());

[url removed, login to view](sTerminate);

[url removed, login to view]();

InputStream inFromServer = [url removed, login to view]();

DataInputStream in = new DataInputStream(inFromServer);

while (true) {

int numRead = [url removed, login to view](buffer, 0, len);

if (numRead == -1) break;

[url removed, login to view](buffer, numRead);

}

// write sockets response to file

...

...

...

Socket write must be null-terminated, and the incoming read will also be null-terminated.

Kỹ năng: Java

Xem thêm: java socket write, java socket read, java socket read bytes, java socket write read, java write read socket, socket java read, java read socket write file, read write java socket, java read socket, java socket datainputstream, address write, read write java sockets, java flush, flush java, urgent java, urgent - java, socket java, read, len, java + fix, socket project, socket fix, fix incoming, listen write, java file read

Về Bên Thuê:
( 3 nhận xét ) Melbourne, Netherlands

Mã Dự Án: #1746070