I have a client and server. The client has to read a file in blocks and send it over as the block is filled. The server reads in the blocks and writes out the data to a file. There is no assumption that the data is ASCII text or contains any newlines.
A part of my code is for Server.java is:
DataInputStream input = new DataInputStream(mySocket.getInputStream());
File file = new File("whatever");
byte filebyte = new byte;
FileOutputStream fileOS = new FileOutputStream(file);
Part of the code from Client.java is:
byte buf = new byte;
File file = new File(filename);
FileInputStream fileIS = new FileInputStream(file);
while(fileIS.read(buf) != -1)
I am getting a bad file number error on the server side. I'm not sure where to go from here.
Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.