how to chop out an ipaddress from a packet using java -
"i have packet format(srcip,destip,protocol number,frame length)in files in file.i need scrip.
49.112.250.206,0.217.206.74,17,1458 25.82.23.122,211.231.164.237,6,46 218.55.186.252,211.231.171.101,6,46 36.63.70.74,73.151.138.2,6,1504 232.60.178.64,78.217.241.214,6,1504 181.175.235.118,58.57.101.205,6,1504 133.203.23.94,74.110.251.121,6,1504 ...... ......"
for (list<string> read : readfiles.values()) { while(last>=0) { last=1; string element=read.get(first); stringtokenizer st=new stringtokenizer(element, ","); //int token=integer.parseint(st.nexttoken(",")); first++; } }
string tmp[]=element.split(" "); //get 1 one for(string s:tmp) { system.out.println(s.split(",")[0]); //get srcip }
Comments
Post a Comment