Questions tagged [dataoutputstream]

A mechanism for writing abstract data to a stream

A DataOutputStream is a mechanism for writing any abstract data to a stream, regardless of the type of the data. A stream is usually comprised of data to write to a local file, or data being transmitted to a remote server over a network protocol such as HTTP or FTP.

An DataOutputStream is abstract, and doesn't describe the type of data that is being written. Typically, if you are able to, you would implement one of the subclasses instead, such as FileOutputStream, which more appropriately describes the type of data being handled, and provides additional methods appropriate for that data type.

257 questions
0
votes
0 answers

Java Android DataOutputStream kinda broken after sending numerous of .writeInt() in a min

It only happens in Androids, not PCs and my server is made using C++ Lets say I made a function for sending packet consists of 3 int and one char void SendTestPacket(int num1, int num2, int num3) { System.out.println("Function called"); …
D13
  • 123
  • 3
  • 12
0
votes
0 answers

Correct place to close DataOutputStream?

I'm currently working on a program that creates a thread for each file read in, reads through it and writes specific info to another file.. My issue here is I am not sure where exactly I need to close the DataOutputStream... Closing it within the…
Nihat
  • 65
  • 9
0
votes
1 answer

Java Server - How to take input from InputStreamReader and convert to a String?

I'm trying to get a very simple Client-Server system to work, where the Client will send a String over to the Server, and the server will then store that String into a file. The client sends the string through: //Other Code sockStrm = new…
0
votes
2 answers

java Connection reset error

I am quite a newbie to Java. Please excuse me if you find this as a very basic question.There are many answers available already in stack overflow about this and I went through almost all the possible helps i can get in Stack overflow and also in…
Chiyaan Suraj
  • 1,021
  • 2
  • 13
  • 27
0
votes
1 answer

is.readUTF() not recieving message

For the chat program in android side I am sending message via DataInput stream as Socket sck = new Socket(); sck.connect(new InetAddress("192.168.1.91",1500),2000); if(sck.isConnected()) { DataOutputStream os = new…
0
votes
1 answer

Stream cannot be reopened while doing bytes write to OutputStream in a loop

When I put inLoop() method in a while loop, then the server never runs. It terminates but I want the server to continuously send bytes to the client again and again. How do I do that ? SimpleSPPServer - public class SimpleSPPServer { //start…
sjain
  • 23,126
  • 28
  • 107
  • 185
0
votes
0 answers

C# client and java server interaction

Hello all I hava a big problem with my client-server interaction, when I send a data from client to server it's work but when I send a data from server to my C# client the data are not recieved. my code: server: public void ReceiveData(Socket…
Isador
  • 41
  • 6
0
votes
1 answer

Java - Program crashing after multiple uses of writeBytes

I've got a very simple multithreaded server that just prints back the client's input. The problem I'm having is that the client is crashing out after more than one use of outToServer.writeBytes(). My source code for the client is here: public class…
JamEngulfer
  • 747
  • 4
  • 11
  • 33
0
votes
2 answers

Resolving java.lang.outofmemory error causing half of the file to be uploaded to server

I am trying to upload large video files to the server. I wrote a piece of code which works well for the image so I thought I should work it for the video too. I wrote the below code. public int uploadFile(String sourceFileUri) { String…
Saty
  • 2,563
  • 3
  • 37
  • 88
0
votes
2 answers

How to write byte array reliably

Suppose i have a byte array need to be converted to a char array and send over the network. eg char[] sometoken = String( myByteArray ).toCharArray(); myMethodToSendByteArrayUsingTCPSocket( sometoken ); myByteArray is ASN.1 encoding (is a kerberos…
dorothy
  • 1,213
  • 5
  • 20
  • 35
0
votes
1 answer

Java SSL connection returns previous reply

I'm using an SSL connection to connect with a server (which i have no control over and no access to it's code, could be it's fault, but i wanna be sure), when i send the data (a byte array) for the first time i get the correct response, but in…
0
votes
2 answers

Server/Client errors when too many messages are sent

I have a problem in my server/client TCP multiplayer game whenever I try to send too many messages in a short time (usually over 20 messages in the arc of 20 millis). After a while the messages start to arrive corrupted for some reason (like with…
0
votes
1 answer

After sending byte arrays via dataoutputstream, the received byte arrays are not equal to original byte arrays

For some reasons, I need to send multiple byte arrays separately via server socket, and client socket will receive these byte arrays. After sending byte arrays, I found byte arrays received in client socket are not equal to those in server socket.…
Coding minion
  • 527
  • 2
  • 4
  • 12
0
votes
4 answers

Creating a simple data output file in Java

I am trying to write a simple data output file. When I execute the code I get a "No file exist" as the output and no data.txt file is created in the dir. What am I missing? The odd thing is that it was working fine the other night, but when I…
TroutmasterJ
  • 43
  • 1
  • 1
  • 4
0
votes
2 answers

How can I set progress value correctly?

I searched many times on google and stackoverflow, but I cant find really what I need. I wrote a code which upload file to server with asynctask method. What I did is: In asyntask method I upload my file with post method to my webservice. in…