????Java?е?Socket???
???????????? ???????[ 2015/3/11 14:40:03 ] ????????Java ??????? ???????
????Socket????????????Socket????????????????????????????????????????????????????????????????????????P2P??????????Socket???????????????????TCP/IP??Socket???????????д????????/??????????
??????????
????Unix?????????(IO)?????Open-Read-Write-Close??????????????????????????????IO?????????????????Open??????????????????????豸?????д??????????IO?????????????????????????????????????????λ??ε?????д???????Read??????????IO???????????????????????????????????Write??????????????????е?????????д????IO???????? ?????е?Read??Write?????????????????????????Close????????????IO???????á?
??????Unix??????????????InterProcess Communication?????IPC?????IPC???????????????IO??????????Unix?У???????????????????ж??д???IO????????IO??????????????????豸??????????????socket????????????????????????????????????????socket???????д????????????????socket??????????????socket????
??????Unix???У???BSD?汾??IPC????????TCP??UDPЭ?????????????????????????????socket?????????????socket???????????????????????????????
??????????????????????socket???????????????????????е????socket????????????е??????socket???????????????ɡ???????????з??????????????????socket?д??????????????2??????Э?齫??Щ?????????????????????????socket?????????????????????????????????????????????????
????TCP??UDP???
????????socket????????????????Э??????????????????????????????????????
????????????
????????????Э?飬??????????UDP??User Data Protocol ????????Э?飩??UDP????????????Э?飬????ζ????????η?????????????????????????socket?????????????socket???????????????????????????????????????????
?????????
?????????Э?飬?????TCP(Transfer Control Protocol?????????Э??)????UDP?????TCP?????????????Э?顣???????????????????????????????socket??佨??????????????socket????????????м????????????????????????????????????????????socket?????????????????????????????????????
???????????????????????????????????????socket??????UDP????TCP????????????Э???socket???????????????????-??????????????ó?????????????????????TCP??UDPЭ??????????????????????????????????
??????UDP?У???η?????????????????????????socket?????????????socket??????????????TCP??????????Э?飬??????socket?????????????????????????????н???????????????????TCPЭ???socket????
??????UDP?У?????????????С????64KB?????????TCP???????????????????????TCP????socket???????????????????????????IO???????е?????????????????????
????UDP???????????Э?飬????????????????????????????????socket????????TCP?????????Э?顣????????????????????????????????μ??
????????????TCP??????????????(rlogin??telnet)?????????FTP???????????????????Щ??????????????С?????????UDP???TCP??????????Щ??UDP???????????????????????????Щ?????????????UDP???????????????
????Java?е?socket???
???????????????????Щ????????????????socket??д?????????????????
????????????????????У??????????TCP/IPЭ???socket??????????Э??????UDP/IP????????????????е?socket??????λ??java.net???£??????????????socket??????????????????
??????????д
????????Socket
???????????????????д?????μ???????????socket??
????String host = "127.0.0.1";
????int port = 8919;
????Socket client = new Socket(host?? port);
????????????У?host????????????????????port??????????????????????????????????????????????0~1023??Щ???????????????????Щ?????Щ???????????????????????FTP??HTTP?????????д????????????????????????????????1023?????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11