[Áú¹®]³×Æ®¿÷ ÇÁ·Î±×·¥ °øºÎÁß...Áú¹®...


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]

±Û¾´ÀÌ :¿µÁØ 1998³â 6¿ù 03ÀÏ 15:53:13

¾È³çÇϼ¼¿ä...
³×Æ®¿÷ ÇÁ·Î±×·¥À» °øºÎÇϸ鼭 Ã¥¿¡ ÀÖ´Â ³»¿ëÀ»
±×´ë·Î ÄÚµùÀ» ÇßÁö¿ä.
±×·±µ¥, ¼­¹öÃøÀÇ Å¬·¡½º¿Í Ŭ¶óÀ̾ðÆ®ÃøÀÇ Å¬·¡½º
2°³°¡ Àִµ¥, 2°³¸¦ ¾î¶»°Ô ¿¬°á ½ÃÄÑ ÁÖ¾î¾ßÇÒÁö¸¦
¸ð¸£°Ú±º¿ä µû·Îµû·Î ÄÄÆÄÀÏÇÏ°í ½ÇÇàÀ» ½ÃÅ°´ÂÁö...
¾Æ´Ï¸é ¾î¶»°Ô ......
°á°ú¸¦ º¼¼ö ÀÖ´Â ¹æ¹ýÀ» ¾Ë·ÁÁÖ¼¼¿ä.
½î¾² Çѹø º¸½Ã°í µµ¿ÍÁÖ¼¼¿ä...°¨»çÇÕ´Ï´Ù.


public class SimpleServer {
public static void main(String args[]) {
ServerSocket s = null;
Socket s1;
String sendString = "Hello Net World!";
int slength = sendString.length();
OutputStream s1out;
DataOutputStream dos;


// Register your service on port 5432
try {
s = new ServerSocket(5432);
} catch (IOException e) { }

// Run the listen/accept loop forever
while (true) {
try {
// Wait here and listen for a connection
s1 = s.accept();
// Get a communication stream associated with the socket
s1out = s1.getOutputStream();
dos = new DataOUtputStream (s1out);


//Send your string!
dos.writeUTF(sendString);


// Cosde hte connection, but not the server socket
dos.close();
s1out.close();
s1.close();
} catch (IOException e) { }
}
}
}


******************************************************


import java.io.*;
import java.net.*;


public class SimpleClient {
public static void main(String args[]) throws IOExcption {
int c;
Socket s1;
InputStream s1In;
DataInputStream dis;


// Open your conneciton to sunbert, at port 5432
s1 = new Socket("sunbert", 5432);
// Get an input file handle from the socket and read the input


s1In = s1.getInputStream();
dis = new DataInputStream (s1In);


String st = new String (dis.readUTF());
System.ou.println(st);

//When done, just close the connection and exit
dis.close();
s1In.close();
s1.close();
}
}






´ÙÀ½ ±Ûµé:



À̾ ±Û¿Ã¸®±â(´äÇϱâ)

À̸§:
E-Mail:
Á¦¸ñ:
³»¿ë:
°ü·Ã URL(¼±ÅÃ):
URL Á¦¸ñ(¼±ÅÃ):
°ü·Ã À̹ÌÁö URL:


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]