java socket and web programing [closed]

被刻印的时光 ゝ 提交于 2021-01-29 07:23:48

问题


sir in java-ee how could i get detail of packet header( source_IP,destination_IP,Source_Port,Destination_Port only ) which are transmitting and receiving at our system through socket.... whenever we open browser and open any site such as www.stackoverflow.com then our java-ee program's output comes as fallow if 222 packet transfer takes place then detail of all the 222 source_IP Destination_ip source_port destination_port 192.168.5.10 64.34.119.12 2121 2929 64.34.119.12 192.168.5.10 . .
. . . . . . . . and so on...


回答1:


Not in plain Java but with the help of some libraries like http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/




回答2:


Yes you can capture all the packets that are travelling through a specific interface on any machine, there are many tools like wireshark etc. which help you do so, and since these are open source you can see the source and pick what you need out of them :)




回答3:


socket is an end point communication between two machines. By using server socket u can get the destination ip and port. In case client view also you can get the source ip not port.using port only u are connecting to your server.




回答4:


As far as i know, you can't do this with plain java. In Java you can only do point to point connections via Sockets. For capturing all packets, the network card must also be in promiscuous mode. Switching to this mode can't also be done in plain java. You could use RMI to call native code, but then you are platform dependend.



来源:https://stackoverflow.com/questions/10408505/java-socket-and-web-programing

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!