-
-
Save DylanLukes/635564 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package alphatunnel; | |
import java.io.IOException; | |
import java.io.FilterInputStream; | |
import java.net.Socket; | |
import java.net.UnknownHostException; | |
import java.nio.CharBuffer; | |
import java.util.logging.Level; | |
import java.util.logging.Logger; | |
public class server extends Thread { | |
private static byte[] buffer; | |
public static FilterInputStream fromServer; | |
@Override | |
public void run() { | |
try { | |
buffer = new byte[4096]; | |
Main.log("Connecting to the real server..."); | |
Socket skt = new Socket("68.199.65.198", 6776); | |
Main.log("A connection has been established."); | |
fromServer = new FilterInputStream(skt.getInputStream()); | |
while (skt.isConnected()) { | |
if (fromServer.available() > 0) { | |
fromServer.read(buffer); | |
Main.log("Server: " + buffer); | |
client.toClient.append(buffer); | |
} | |
} | |
} catch (UnknownHostException ex) { | |
Logger.getLogger(server.class.getName()).log(Level.SEVERE, null, ex); | |
} catch (IOException ex) { | |
Logger.getLogger(server.class.getName()).log(Level.SEVERE, null, ex); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment