Created
January 6, 2012 15:32
-
-
Save hubplace/1571076 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String sendTCPBytes(String bytes, String[] ip) throws IOException | |
{ | |
String downloaded = null; | |
Socket socket = new Socket(ip[2], 58889); | |
socket.setReceiveBufferSize(10*1024 +1024); | |
socket.setSendBufferSize(10*1024+1024); | |
socket.setTcpNoDelay(true); | |
DataOutputStream upload = new DataOutputStream(socket.getOutputStream()); | |
BufferedReader download = new BufferedReader(new InputStreamReader(socket.getInputStream())); | |
String caps = bytes; | |
System.out.println(caps); | |
upload.writeBytes(caps); | |
upload.flush(); | |
String get; | |
downloaded = download.readLine(); | |
System.out.println("[TCP]: FROM server: >>> " + downloaded); // << always missing... | |
socket.close(); | |
return downloaded; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment