serversocket

Android Bluetooth: java.io.IOException: Service discovery failed

两盒软妹~` 提交于 2019-12-03 16:49:48
I'm trying to develop an Android application which transfers images from one device to another. The received image would then be shown on the ImageView inside my application. To achieve my task, I thought to send a byte array of the bitmap. I'm able to get the first image on the imageview. But, as soon as I click on the button to send another image the application fails to send the bitmap. It shows me an exception "java.io.IOException: Service fiscovery failed." To send any image successfully I need to restart my application on the receiving/remote device. Can anyone please suggest a solution

Sending an ArrayList<String> from the server side to the client side over TCP using socket? [closed]

喜你入骨 提交于 2019-12-03 13:28:20
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center . I'm trying to send one object from the server side socket to the client side socket over TCP. I can't find out where is the problem. Here is the error I'm getting on the Client side: java.io.EOFException at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2280) at java.io.ObjectInputStream

What is the difference between Socket and ServerSocket?

天大地大妈咪最大 提交于 2019-12-03 08:12:42
问题 If Socket represents client side and ServerSocket represents server side, why Socket.read reads the data from server side? I'm really confused, Can you please clarify it to me? 回答1: (I post this answer because I always feel it's important to make the logic right.) I suggest you take a look at the following sample. http://docs.oracle.com/javase/tutorial/networking/sockets/clientServer.html Admittedly, when carrying out TCP/IP communication, all the necessary information can be provided by the

How to recive more than 65000 bytes in C++ socket using recv()

限于喜欢 提交于 2019-12-03 00:47:23
I am developing a client server application (TCP) in Linux using C++. I want to send more than 65,000 bytes at the same time. In TCP, the maximum packet size is 65,535 bytes only. How can I send the entire bytes without loss? Following is my code at server side. //Receive the message from client socket if((iByteCount = recv(GetSocketId(), buffer, MAXRECV, MSG_WAITALL)) > 0) { printf("\n Received bytes %d\n", iByteCount); SetReceivedMessage(buffer); return LS_RESULT_OK; } If I use MSG_WAITALL it takes a long time to receive the bytes so how can I set the flag to receive more than 1 million

What is the difference between Socket and ServerSocket?

╄→гoц情女王★ 提交于 2019-12-02 23:27:36
If Socket represents client side and ServerSocket represents server side, why Socket.read reads the data from server side? I'm really confused, Can you please clarify it to me? (I post this answer because I always feel it's important to make the logic right.) I suggest you take a look at the following sample. http://docs.oracle.com/javase/tutorial/networking/sockets/clientServer.html Admittedly, when carrying out TCP/IP communication, all the necessary information can be provided by the Socket class alone for the sole purpose of communication. No matter it is on server side or client side. As

Android web server not supported by firefox

只谈情不闲聊 提交于 2019-12-02 23:20:49
问题 I have created a webserver in Android which binds to port 2090 and serves the sdcard of Android devices it works fine if I type the ip:port/index.htm in Internet Explorer then it works just great but when I open it in other browsers than it opens the HTML file as text please help me. This is my code. The server starter class: package dolphin.developers.com; import java.io.File; import java.io.IOException; import java.net.InetAddress; import android.app.Activity; import android.os.Bundle;

how to write bytes to server socket

社会主义新天地 提交于 2019-12-02 17:50:44
问题 I'm writing a java socket program to read data from server, I've no control to server, below is protocol agreed, 2-bytes: magic number 2-bytes: data length N-bytes: ASCII string data payload Big endian for the magic number and data length For Example: if my request is "command/1/getuserlist" how to construct th request match above protocol and read the response back to List I'm new to socket programming and have no idea how to build my request and read the response back. can someone guide me

Broadcasting packet to client not working in java

痴心易碎 提交于 2019-12-02 15:32:49
问题 I have multiple transmitters configured to send back a response when they receive a broadcast packet sent from a server through local port 5255, remote port 5252 containing the string "AST show me\0" (as stated in transmitters' manual). This should help me to scan for all the transmitters within the local network. I have implemented a server side code to broadcast that string message, but when I run the code , it have a bug at the following line code : socket.receive(packet1); I don't really

Android web server not supported by firefox

依然范特西╮ 提交于 2019-12-02 14:24:06
I have created a webserver in Android which binds to port 2090 and serves the sdcard of Android devices it works fine if I type the ip:port/index.htm in Internet Explorer then it works just great but when I open it in other browsers than it opens the HTML file as text please help me. This is my code. The server starter class: package dolphin.developers.com; import java.io.File; import java.io.IOException; import java.net.InetAddress; import android.app.Activity; import android.os.Bundle; import android.os.Environment; import android.util.Log; import android.widget.Toast; import dolphin

Application hangs when attempting to retrieve text from an inputstream

流过昼夜 提交于 2019-12-02 11:23:38
Situation I've been creating a program to exchange messages between two computers in the LAN. One computer identifies itself as the server while the other is a client. Upon startup, the user has to enter the Host and the Port of another computer, should he wish to connect as a client to that machine. The setup of how it works is very basic: You type your message, hit enter and it shows up on your own screen. After that your conversation partner has to click a button to retrieve the latest messages and it should show up on his screen. This goes on untill someone leaves. Problem The program