¡@

Home 

2014/10/16 ¤W¤È 08:23:41

android Programming Glossary: serversocket

Send message from a basic server to a specific client

http://stackoverflow.com/questions/10777678/send-message-from-a-basic-server-to-a-specific-client

it even possible in Java Ok here goes. setting up server ServerSocket serverSocket new ServerSocket 8000 0 IPaddress creating a client.. here goes. setting up server ServerSocket serverSocket new ServerSocket 8000 0 IPaddress creating a client socket to accept it Socket.. need to maintain a separate connection to each client. The ServerSocket class has an accept function which returns a Socket object...

Android webserver shows html pages as text

http://stackoverflow.com/questions/18055743/android-webserver-shows-html-pages-as-text

java.io.File import java.io.IOException import java.net.ServerSocket import java.net.Socket import java.net.SocketException public.. private String indexFileName index.htm private ServerSocket server private int numThreads 50 public JHTTP File documentRootDirectory.. this.indexFileName indexFileName this.server new ServerSocket port public JHTTP File documentRootDirectory int port throws..

Tablet(iPad/Android)-Server Communication Protocol

http://stackoverflow.com/questions/4050166/tabletipad-android-server-communication-protocol

in java is easy I am making it very short here server side ServerSocket ss new ServerSocket port Socket s ss.accept InputStream is s.getInputStream.. making it very short here server side ServerSocket ss new ServerSocket port Socket s ss.accept InputStream is s.getInputStream client..

Audio stream buffering

http://stackoverflow.com/questions/4557450/audio-stream-buffering

in Adnroid versions below 8. In stream proxy you create ServerSocket read from audio stream and write to player. So actually I can..

Connecting 2 Emulator instances In Android

http://stackoverflow.com/questions/4683854/connecting-2-emulator-instances-in-android

Called when the activity is first created. private ServerSocket serverSocket null private TextView tv public static final int.. public void Connect throws IOException serverSocket new ServerSocket serverSocket.bind new InetSocketAddress 10.0.2.15 4444 while.. on 6000 public class SocketServer extends Activity ServerSocket ss null String mClientMsg Thread myCommsThread null protected..

How to write an Android SocketServer to listen on wifi

http://stackoverflow.com/questions/5054076/how-to-write-an-android-socketserver-to-listen-on-wifi

wifi share improve this question When you create a ServerSocket you listen to a port on the localhost Its up to you if you want..

MediaPlayer stutters at start of mp3 playback

http://stackoverflow.com/questions/5343730/mediaplayer-stutters-at-start-of-mp3-playback

import java.net.InetAddress import java.net.ServerSocket import java.net.Socket import java.net.SocketException import.. private Thread thread private boolean isRunning private ServerSocket socket private int port public StreamProxy Create listening.. public StreamProxy Create listening socket try socket new ServerSocket SERVER_PORT 0 InetAddress.getByAddress new byte 127 0 0 1 socket.setSoTimeout..

Android ServerSocket programming with jCIFS streaming files

http://stackoverflow.com/questions/9058135/android-serversocket-programming-with-jcifs-streaming-files

ServerSocket programming with jCIFS streaming files I've got a bit of an.. I've made some progress though. I think I need to use a ServerSocket in my application to somehow create a bridge between the NAS.. listens for requests. This port may be obtained from ServerSocket.getLocalPort . Then give this URL to some app and your server..

Send message from a basic server to a specific client

http://stackoverflow.com/questions/10777678/send-message-from-a-basic-server-to-a-specific-client

in Java Ok here goes. setting up server ServerSocket serverSocket new ServerSocket 8000 0 IPaddress creating a client socket to.. creating a client socket to accept it Socket clientSocket serverSocket.accept Now I accept the client in a seperate thread so that.. just do it in a loop for int i 0 i 5 i clientSocket serverSocket.accept start a new thread passing it the clientSocket as an..

Problems connecting with bluetooth Android

http://stackoverflow.com/questions/4444235/problems-connecting-with-bluetooth-android

BluetoothServerSocket btserver public BluetoothSocket serverSocket public UUID uuid UUID.fromString 00001101 0000 1000 8000 00805F9B34FB..

Connecting 2 Emulator instances In Android

http://stackoverflow.com/questions/4683854/connecting-2-emulator-instances-in-android

when the activity is first created. private ServerSocket serverSocket null private TextView tv public static final int SERVERPORT.. e.printStackTrace public void Connect throws IOException serverSocket new ServerSocket serverSocket.bind new InetSocketAddress 10.0.2.15.. Connect throws IOException serverSocket new ServerSocket serverSocket.bind new InetSocketAddress 10.0.2.15 4444 while true Socket..

Stream live video from phone to phone using socket fd

http://stackoverflow.com/questions/6116880/stream-live-video-from-phone-to-phone-using-socket-fd

private Handler handler new Handler private ServerSocket serverSocket Called when the activity is first created. @Override protected.. run connectionStatus.setText Listening on IP SERVERIP serverSocket new ServerSocket SERVERPORT while true listen for incoming.. while true listen for incoming clients Socket client serverSocket.accept handler.post new Runnable @Override public void run..

Android - Server Socket

http://stackoverflow.com/questions/7455016/android-server-socket

null DataOutputStream dataOutputStream null ServerSocket serverSocket null try serverSocket new ServerSocket SERVERPORT System.out.println.. dataOutputStream null ServerSocket serverSocket null try serverSocket new ServerSocket SERVERPORT System.out.println Listening SERVERPORT.. Exception e e.printStackTrace while true try socket serverSocket.accept BufferedReader in new BufferedReader new InputStreamReader..

“Service discovery failed” from Android Bluetooth Insecure Rfcomm

http://stackoverflow.com/questions/8515572/service-discovery-failed-from-android-bluetooth-insecure-rfcomm

Use a temporary object that is later assigned to serverSocket because serverSocket is final BluetoothServerSocket tmp null.. object that is later assigned to serverSocket because serverSocket is final BluetoothServerSocket tmp null try MY_UUID is the app's.. for service requests for SERVICE_NAME catch IOException e serverSocket tmp ServerThread Listening for Connections BluetoothSocket socket..

Android ServerSocket programming with jCIFS streaming files

http://stackoverflow.com/questions/9058135/android-serversocket-programming-with-jcifs-streaming-files

create Thread waiting for connection Socket accept serverSocket.accept one thread may be ok since you'd handle single client.. final String fileMimeType private final ServerSocket serverSocket private Thread mainThread Some HTTP response status codes private.. forceMimeType null forceMimeType file.mimeType serverSocket new ServerSocket 0 mainThread new Thread new Runnable @Override..

Send message from a basic server to a specific client

http://stackoverflow.com/questions/10777678/send-message-from-a-basic-server-to-a-specific-client

I want to choose between clients to send the message to. Is it even possible in Java Ok here goes. setting up server ServerSocket serverSocket new ServerSocket 8000 0 IPaddress creating a client socket to accept it Socket clientSocket serverSocket.accept.. to send the message to. Is it even possible in Java Ok here goes. setting up server ServerSocket serverSocket new ServerSocket 8000 0 IPaddress creating a client socket to accept it Socket clientSocket serverSocket.accept Now I accept the client in.. share improve this question Yes it is possible. You need to maintain a separate connection to each client. The ServerSocket class has an accept function which returns a Socket object. That object represents a connection between two points your..

Android webserver shows html pages as text

http://stackoverflow.com/questions/18055743/android-webserver-shows-html-pages-as-text

Jhttp class package dolphin.developers.com import java.io.File import java.io.IOException import java.net.ServerSocket import java.net.Socket import java.net.SocketException public class JHTTP extends Thread private File documentRootDirectory.. public class JHTTP extends Thread private File documentRootDirectory private String indexFileName index.htm private ServerSocket server private int numThreads 50 public JHTTP File documentRootDirectory int port String indexFileName throws IOException.. as a directory this.documentRootDirectory documentRootDirectory this.indexFileName indexFileName this.server new ServerSocket port public JHTTP File documentRootDirectory int port throws IOException this documentRootDirectory port index.htm public..

Tablet(iPad/Android)-Server Communication Protocol

http://stackoverflow.com/questions/4050166/tabletipad-android-server-communication-protocol

devices ipad android linux windows . Using sockets in java is easy I am making it very short here server side ServerSocket ss new ServerSocket port Socket s ss.accept InputStream is s.getInputStream client side Socket s new Socket server.address.. android linux windows . Using sockets in java is easy I am making it very short here server side ServerSocket ss new ServerSocket port Socket s ss.accept InputStream is s.getInputStream client side Socket s new Socket server.address port same port as..

Audio stream buffering

http://stackoverflow.com/questions/4557450/audio-stream-buffering

is to use stream proxy. Usually it is used for playing streams in Adnroid versions below 8. In stream proxy you create ServerSocket read from audio stream and write to player. So actually I can manage buffering there. I can cache stream and write to MediaPlayer..

Connecting 2 Emulator instances In Android

http://stackoverflow.com/questions/4683854/connecting-2-emulator-instances-in-android

write code for Server public class ServerActivity extends Activity Called when the activity is first created. private ServerSocket serverSocket null private TextView tv public static final int SERVERPORT 4444 @Override public void onCreate Bundle savedInstanceState.. catch block tv.setText Not connected e.printStackTrace public void Connect throws IOException serverSocket new ServerSocket serverSocket.bind new InetSocketAddress 10.0.2.15 4444 while true Socket socket serverSocket.accept tv.setText Connected..... on emulator 5554 and the client on 5556. My server code listening on 6000 public class SocketServer extends Activity ServerSocket ss null String mClientMsg Thread myCommsThread null protected static final int MSG_ID 0x1337 public static final int SERVERPORT..

How to write an Android SocketServer to listen on wifi

http://stackoverflow.com/questions/5054076/how-to-write-an-android-socketserver-to-listen-on-wifi

wifi connection to pass to the SocketServer android sockets wifi share improve this question When you create a ServerSocket you listen to a port on the localhost Its up to you if you want to nominate your own local host address . Read these two..

MediaPlayer stutters at start of mp3 playback

http://stackoverflow.com/questions/5343730/mediaplayer-stutters-at-start-of-mp3-playback

import java.io.IOException import java.io.OutputStream import java.net.InetAddress import java.net.ServerSocket import java.net.Socket import java.net.SocketException import java.net.SocketTimeoutException import java.net.UnknownHostException.. implements Runnable private static final int SERVER_PORT 8888 private Thread thread private boolean isRunning private ServerSocket socket private int port public StreamProxy Create listening socket try socket new ServerSocket SERVER_PORT 0 InetAddress.getByAddress.. isRunning private ServerSocket socket private int port public StreamProxy Create listening socket try socket new ServerSocket SERVER_PORT 0 InetAddress.getByAddress new byte 127 0 0 1 socket.setSoTimeout 5000 port socket.getLocalPort catch UnknownHostException..

Android ServerSocket programming with jCIFS streaming files

http://stackoverflow.com/questions/9058135/android-serversocket-programming-with-jcifs-streaming-files

ServerSocket programming with jCIFS streaming files I've got a bit of an issue and I've been asking regarding it quite a few times but.. me and what I've asked about a few times before. I think I've made some progress though. I think I need to use a ServerSocket in my application to somehow create a bridge between the NAS and the application that's playing the content. I'm thinking.. http localhost 12345 where 12345 is port on which your server listens for requests. This port may be obtained from ServerSocket.getLocalPort . Then give this URL to some app and your server waits for connection and sends data. A note about http streaming..

Send message from a basic server to a specific client

http://stackoverflow.com/questions/10777678/send-message-from-a-basic-server-to-a-specific-client

between clients to send the message to. Is it even possible in Java Ok here goes. setting up server ServerSocket serverSocket new ServerSocket 8000 0 IPaddress creating a client socket to accept it Socket clientSocket serverSocket.accept Now I accept.. ServerSocket serverSocket new ServerSocket 8000 0 IPaddress creating a client socket to accept it Socket clientSocket serverSocket.accept Now I accept the client in a seperate thread so that the main thread does not freeze becauz accept function is blocking... on stackoverflow. As to accepting connections and starting threads just do it in a loop for int i 0 i 5 i clientSocket serverSocket.accept start a new thread passing it the clientSocket as an argument Other possibly useful links https developer.android.com..

Problems connecting with bluetooth Android

http://stackoverflow.com/questions/4444235/problems-connecting-with-bluetooth-android

deviceDescoberto public BluetoothDevice deviceRemoto public BluetoothServerSocket btserver public BluetoothSocket serverSocket public UUID uuid UUID.fromString 00001101 0000 1000 8000 00805F9B34FB public OutputStream outStream public InputStream instream..

Connecting 2 Emulator instances In Android

http://stackoverflow.com/questions/4683854/connecting-2-emulator-instances-in-android

Server public class ServerActivity extends Activity Called when the activity is first created. private ServerSocket serverSocket null private TextView tv public static final int SERVERPORT 4444 @Override public void onCreate Bundle savedInstanceState.. e TODO Auto generated catch block tv.setText Not connected e.printStackTrace public void Connect throws IOException serverSocket new ServerSocket serverSocket.bind new InetSocketAddress 10.0.2.15 4444 while true Socket socket serverSocket.accept tv.setText.. block tv.setText Not connected e.printStackTrace public void Connect throws IOException serverSocket new ServerSocket serverSocket.bind new InetSocketAddress 10.0.2.15 4444 while true Socket socket serverSocket.accept tv.setText Connected... And code..

Stream live video from phone to phone using socket fd

http://stackoverflow.com/questions/6116880/stream-live-video-from-phone-to-phone-using-socket-fd

String SERVERIP public static final int SERVERPORT 6775 private Handler handler new Handler private ServerSocket serverSocket Called when the activity is first created. @Override protected void onCreate Bundle savedInstanceState super.onCreate savedInstanceState.. null handler.post new Runnable @Override public void run connectionStatus.setText Listening on IP SERVERIP serverSocket new ServerSocket SERVERPORT while true listen for incoming clients Socket client serverSocket.accept handler.post new.. on IP SERVERIP serverSocket new ServerSocket SERVERPORT while true listen for incoming clients Socket client serverSocket.accept handler.post new Runnable @Override public void run connectionStatus.setText Connected. try Begin video..

Android - Server Socket

http://stackoverflow.com/questions/7455016/android-server-socket

code too. Socket socket null DataInputStream dataInputStream null DataOutputStream dataOutputStream null ServerSocket serverSocket null try serverSocket new ServerSocket SERVERPORT System.out.println Listening SERVERPORT System.out.println Server IP.. null DataInputStream dataInputStream null DataOutputStream dataOutputStream null ServerSocket serverSocket null try serverSocket new ServerSocket SERVERPORT System.out.println Listening SERVERPORT System.out.println Server IP SERVERIP catch Exception.. SERVERPORT System.out.println Server IP SERVERIP catch Exception e e.printStackTrace while true try socket serverSocket.accept BufferedReader in new BufferedReader new InputStreamReader socket.getInputStream System.out.println ip socket.getInetAddress..

“Service discovery failed” from Android Bluetooth Insecure Rfcomm

http://stackoverflow.com/questions/8515572/service-discovery-failed-from-android-bluetooth-insecure-rfcomm

To Listen For Connections Log.i TAG Constructing a ServerThread Use a temporary object that is later assigned to serverSocket because serverSocket is final BluetoothServerSocket tmp null try MY_UUID is the app's UUID string also used by the client.. Log.i TAG Constructing a ServerThread Use a temporary object that is later assigned to serverSocket because serverSocket is final BluetoothServerSocket tmp null try MY_UUID is the app's UUID string also used by the client code tmp btAdapter.listenUsingInsecureRfcommWithServiceRecord.. Log.i TAG Started listening on insecure RFCOMM channel for service requests for SERVICE_NAME catch IOException e serverSocket tmp ServerThread Listening for Connections BluetoothSocket socket while true try socket serverSocket.accept catch IOException..

Android ServerSocket programming with jCIFS streaming files

http://stackoverflow.com/questions/9058135/android-serversocket-programming-with-jcifs-streaming-files

Range values. Basic tasks of http server create ServerSocket create Thread waiting for connection Socket accept serverSocket.accept one thread may be ok since you'd handle single client at a time read http request socket.getInputStream mainly check.. boolean debug false private final Browser.FileEntry file private final String fileMimeType private final ServerSocket serverSocket private Thread mainThread Some HTTP response status codes private static final String HTTP_BADREQUEST 400 Bad Request HTTP_416.. f String forceMimeType throws IOException file f fileMimeType forceMimeType null forceMimeType file.mimeType serverSocket new ServerSocket 0 mainThread new Thread new Runnable @Override public void run try while true Socket accept serverSocket.accept..