Á¦°¡ ¸¹µç AppletÀε¥ Àß ¾ÈµÇ´Â±º¿ä.


[ Follow Ups ] [ Post Followup ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]

Posted by ³ëÁ¤¿À on June 04, 1997 at 23:33:29: ºÎŹµå¸³´Ï´Ù.
Á¦°¡ URLConnectionÀ» ÀÌ¿ëÇؼ­ File¿¡ Ãâ·ÂÀ»
ÇÒ·Á°í Çϴµ¥ Àß ¾ÈµÅ¼­¿ä...
File¿¡¼­ Àоî¿À´Â°Ç µÇ´Âµ¥, File¿¡ ¾²´Â°ÍÀÌ ¾ÈµË´Ï´Ù. ¾Æ½Ã´ÂºÐ °è½Ã¸é ºÎŹµå¸³´Ï´Ù. ¼Ò½º´Â ´ÙÀ½°ú °°½À´Ï´Ù.
//******************************************************************************
// count.java:	Applet

//
//******************************************************************************
import java.applet.*;
import java.awt.*;
import java.io.*;
import java.net.*;
import java.lang.Integer;
//==============================================================================
// Main Class for applet count
//
//==============================================================================
public class count extends Applet
{
	
	static DataInputStream rs;
	static DataOutputStream ws;
	static PrintStream ps;
	static int cnt;
	private URL count_url = null;
	private URL count_url2 = null;
	private URLConnection uc = null;
	
	// count Class Constructor
	//--------------------------------------------------------------------------
	public count()
	{
		// TODO: Add constructor code here
	}
	
	public String getAppletInfo()
	{
		return "Name: count\r\n" +
		       "Author: ³ëÁ¤¿À\r\n" +
		       "Created with Microsoft Visual J++ Version 1.1";
	}

	
	public void init()
	{
        
    	
	    String str;
		//byte buffer[] = new byte[3];
	    resize(20, 20);
		try {
			count_url = new URL("http://indy.imige.co.kr/~noon/Tmp/ttt.ttt");
			rs = new DataInputStream(count_url.openStream());
		    
		} catch (IOException e) {
			System.out.println("File IO Error!!");
		}
					
		try {
			
			cnt = rs.readInt();
			rs.close();
		} catch (IOException e) {}
		
		
		//file_Stream.close();
		// TODO: Place additional initialization code here
	}
	
	public void destroy()
	{
		// TODO: Place applet cleanup code here
	}
	
	public void paint(Graphics g)
	{
		g.drawString(String.valueOf(cnt), 10, 20);
		
	}
	
	public void start()
	{
		
		String s = "hello\n";
		cnt = cnt + 1;
		try {
			uc = count_url.openConnection();
			uc.setDoOutput(true);
		} catch (IOException e) {
			System.out.println("Error in opening URLConnection");
		}
		try {
			ws = new DataOutputStream(uc.getOutputStream());
		} catch (Exception e) {}
		try {
			ws.writeBytes("test\r\n");
			ws.flush();
			
		} catch (IOException e) {
			System.out.println("Error in writeing to file");
		}
			
	}
	
	public void stop()
	{
	}

}



Follow Ups:



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

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


[ Follow Ups ] [ Post Followup ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]