Setup > Terminal  메뉴에서


coding[receive]:KS5601

coding[transmit]KS5601:

locale:korean

CodePage:949




netstat -an|find "10001"

10001 번 포트를 찾을 때


readLine() 을 사용할 수 없는 경우이다.

원 출처는 http://javacan.tistory.com/entry/35



InputStream is;

is = connectionSocket.getInputStream();

String msgBodyStr = "";


BufferedReader br = new BufferedReader(new InputStreamReader(is));

char[] buffBody = new char[1024];

int len = -1;

int sumLen = 0;

while ((len = br.read(buffBody)) != -1){   // br.read(buffBody,0,1); 도 가능

msgBodyStr += new String(buffBodym0, len);

sumLen += len;

if (sumL > = msgBodyLen){

break;

}

}


popen 보기 c

카테고리 없음 2013. 10. 23. 14:21

#include <stdio.h>

#include <stdlib.h>

#include <strings.h>

#include <unistd.h>

int main ()

{

        FILE *fp;

        char buf[1024];

        char *token;

        int cnt;



        fp = popen("/usr/bin/wc -l abc.txt", "r");

        if (fp == NULL)

        {

                printf("ERROR:popen fail\n");

                exit(0);

        }

        fread(buf, 1, 1024, fp);

        pclose(fp);


        printf("buf:%s\n", buf);

        token = (char *) strtok(buf, " ");

        printf("token:%s\n", token);

        cnt = atoi(token);


        printf("cnt:%d\n", cnt);


}


Unhandled exception type IOException 컴파일 에러 때 

아래 코드 추가


import java.io.IOException;


try {

// 원래 코드

} catch (IOException e) {

 System.out.println (ex.toString());

}




java tcp server 소스

java 2013. 10. 14. 11:25

간단한 java tcp server 소스 


http://hks003.tistory.com/130



$ ls  *.class

$ Sever$Connection.class Server$ConnectionManger.class Server$HTTPMirror.class ...


달러 ($) 표시 클래스는 내부 클래스를 뜻한다.

당연히 프로그램 기동 때 필요한 클래스다.




jsp 에서 xss 방어

java 2013. 9. 5. 16:06

import = "java.util.Enumeration"


<%

String requestMethod = request.getMethod();

Enumeration enu = request.getParameterNames();

String sNames = "";


while (enu.hasMoreElements()) {

sNames = (String)enu.nextElement();

if ( request.getParameter(sNames).indexOf("script") > -1 ||

request.getParameter(sNames).indexOf("\"") > -1 ||

request.getParameter(sNames).indexOf("<") > -1 ||

request.getParameter(sNames).indexOf(">") > -1 ) {

response.sendRedirect("/index.html");

}

%>