How to create socket to receive both text and image [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to create a server which receives both text and image. For text I used DataInputStream dis.readUTF(), and for image, I used ObjectInputStream ois.readObject() to read the image as byte[]. So how can I write code to detect the data receiving is text or byte[]?

You'll have to use some kind of signal from the client to know whether it is sending text or an image.
Alternatively, you could receive on different ports depending on the type of input.

Related

Frames streaming via socket [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am making an android app where i should send camera frames via udp/tcp socket
I get each frame as a byte[] array in a FrameCallback
Then i used the socket to send each time MAX_BUFFER_SIZE bytes from the array
as fragments.
But it's not Effcient enough since the array size sent is about 10M, and there will be alot of buffering when the stream will be desplayed.
I can't compress the array too since it's an OMEGA(n) operation, SO
First of all , what protocol is better for this problem? UDP, TCP ?
And in general , how can i send that huge array over socket in a video streaming efficiency level ?
I solved it by using the UDP Protocol
And used Allocation class to compress the data array, it did the work!

How do i print the Event Listener(Selenium) log generated in console to the notepad text file [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I have done to print logs in the console but I have no idea how to print logs in a text file
Creat a new instance of FileWriter,I will name it fileWriter , give it a target File where to write. Then use the fileWriter.write() to write into the file. When done, call fileWriter.close(), this will save the changes to the file.

Postman Testing [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I am trying to test in Postman a rest end point url. I am unable to upload a file and 2 JSON Objects, both at a time from Postman.
I can do it separately, I mean I can choose a file from form-data(Postman). Can send a JSON object from raw(Postman).But I cannot do at a time both.
Can some one please help me on this.
Using Body->form-data you can put your file and a JSON file(.json extension) with your JSON content.

I would like to make an invice in java using netbeans 8 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
My question is this that i want to make an invice or we can say bill for our customer , so that now i want to make an invice that has a special style it mean customer logos,address
like this and then i want to print it directly by printer devices so plz can anyone help me .
I use netbeas 8 IDE .
You could create a report, using iReport, and send data to fill it. All data can be organized in a model report, like images, grid (sub-report) with monetary values, bar-codes, etc...
http://community.jaspersoft.com/wiki/ireport-designer-tutorials-help

Android/Java - Best way to retrieve information from server? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a server that stores a plain text file with a numerical value. The text file is constantly edited by the server every few minutes or so. What is the best way for an Android Client to retrieve the text file's contents?
The most efficient way would be using Volley library with a string request.
Do something like this:
URL url = new URL("http://www.domain.com/file.txt");
URLConnection urlConnection = url.openConnection();
urlConnection.setConnectTimeout(1000);
InputStream is = urlConnection.getInputStream();

Categories