tcp通信中怎么获得客户端的端口号?

一般情况下,客户端不需要设置端口号调用SOCKET()创建套接口后,直接调用CONNECT()函数连接到目标主机,这中情况下客户端的端口是系统分配的,如果你想自己指定客户... 一般情况下,客户端不需要设置端口号调用SOCKET()创建套接口后,直接调用CONNECT()函数连接到目标主机,这中情况下客户端的端口是系统分配的,如果你想自己指定客户端的端口,那么就像服务端一样,
在SOCKET()创建套接口后,调用一下BIND()函数绑定本机端口,然后再调用CONNECT()函数即可.
别人的回答,那么怎么能知道客户端随机分配的端口号呢
展开
 我来答
920020234
推荐于2017-09-09 · TA获得超过2.4万个赞
知道大有可为答主
回答量:1.2万
采纳率:0%
帮助的人:2198万
展开全部
  TCP端口就是为TCP协议通信提供服务的端口。TCP (Transmission Control Protocol) ,TCP是一种面向连接(连接导向)的、可靠的、基于字节流的运输层(Transport layer)通信协议,由IETF的RFC 793说明(specified)。在计算机网络OSI模型中,它完成第四层传输层所指定的功能,我们的电脑与网络连接的许多应用都是通过TCP端口实现的。获取端口号为两种,分别如下:
  一、静态端口获取
  TCP 0= Reserved
  TCP 1=TCP Port Service Multiplexer
  TCP 2=Death
  TCP 5=Remote Job Entry,yoyo
  TCP 7=Echo
  TCP 11=Skun
  TCP 12=Bomber
  TCP 16=Skun
  TCP 17=Skun
  TCP 18=消息传输协议,skun
  TCP 19=Skun
  TCP 20=FTP Data,Amanda
  TCP 21=文件传输,Back Construction,Blade Runner,Doly Trojan,Fore,FTP trojan,Invisible FTP,Larva, WebEx,WinCrash
  TCP 22=远程登录协议
  TCP 23=远程登录(Telnet),Tiny Telnet Server (= TTS)
  TCP 25=电子邮件(SMTP),Ajan,Antigen,Email Password Sender,Happy 99,Kuang2,ProMail trojan,Shtrilitz,Stealth,Tapiras,Terminator,WinPC,WinSpy,Haebu Coceda
  TCP 27=Assasin
  TCP 28=Amanda
  TCP 29=MSG ICP
  TCP 30=Agent 40421
  TCP 31=Agent 31,Hackers Paradise,Masters Paradise,Agent 40421
  TCP 37=Time,ADM worm
  TCP 39=SubSARI
  TCP 41=DeepThroat,Foreplay
  TCP 42=Host Name Server
  TCP 43=WHOIS
  TCP 44=Arctic
  TCP 48=DRAT
  TCP 49=主机登录协议
  TCP 50=DRAT
  TCP 51=IMP Logical Address Maintenance,Fuck Lamers Backdoor
  TCP 52=MuSka52,Skun
  TCP 53=DNS,Bonk (DOS Exploit)
  TCP 54=MuSka52
  TCP 58=DMSetup
  TCP 59=DMSetup
  TCP 63=whois++
  TCP 64=Communications Integrator
  TCP 65=TACACS-Database Service
  TCP 66=Oracle SQL*NET,AL-Bareki
  TCP 67=Bootstrap Protocol Server
  TCP 68=Bootstrap Protocol Client
  TCP 69=W32.Evala.Worm,BackGate Kit,Nimda,Pasana,Storm,Storm worm,Theef,Worm.Cycle.a
  TCP 70=Gopher服务,ADM worm
  TCP 79=用户查询(Finger),Firehotcker,ADM worm
  TCP 80=超文本服务器(Http),Executor,RingZero
  TCP 81=Chubo,Worm.Bbeagle.q
  TCP 82=Netsky-Z
  TCP 88=Kerberos krb5服务
  TCP 99=Hidden Port
  TCP 102=消息传输代理
  TCP 108=SNA网关访问服务器
  TCP 109=Pop2
  TCP 110=电子邮件(Pop3),ProMail
  TCP 113=Kazimas, Auther Idnet
  TCP 115=简单文件传输协议
  TCP 118=SQL Services, Infector 1.4.2
  TCP 119=新闻组传输协议(Newsgroup(Nntp)), Happy 99
  TCP 121=JammerKiller, Bo jammerkillah
  UDP 123=网络时间协议(NTP),Net Controller
  TCP 129=Password Generator Protocol
  TCP 133=Infector 1.x
  TCP 135=微软DCE RPC end-point mapper服务
  TCP 137=微软Netbios Name服务(网上邻居传输文件使用)
  TCP 138=微软Netbios Name服务(网上邻居传输文件使用)
  TCP 139=微软Netbios Name服务(用于文件及打印机共享)
  TCP 142=NetTaxi
  TCP 143=IMAP
  TCP 146=FC Infector,Infector
  TCP 150=NetBIOS Session Service
  TCP 156=SQL服务器
  TCP 161=Snmp
  TCP 162=Snmp-Trap
  TCP 170=A-Trojan
  TCP 177=X Display管理控制协议
  TCP 179=Border网关协议(BGP)
  TCP 190=网关访问控制协议(GACP)
  TCP 194=Irc
  TCP 197=目录定位服务(DLS)
  TCP 256=Nirvana
  TCP 315=The Invasor
  TCP 371=ClearCase版本管理软件
  TCP 389=Lightweight Directory Access Protocol (LDAP)
  TCP 396=Novell Netware over IP
  TCP 420=Breach
  TCP 421=TCP Wrappers
  TCP 443=安全服务
  TCP 444=Simple Network Paging Protocol(SNPP)
  TCP 445=Microsoft-DS
  TCP 455=Fatal Connections
  TCP 456=Hackers paradise,FuseSpark
  TCP 458=苹果公司QuickTime
  TCP 513=Grlogin
  TCP 514=RPC Backdoor
  TCP 520=EFS (UDP520=RIP)
  TCP 531=Rasmin,Net666
  TCP 544=kerberos kshell
  TCP 546=DHCP Client
  TCP 547=DHCP Server
  TCP 548=Macintosh文件服务
  TCP 555=Ini-Killer,Phase Zero,Stealth Spy
  TCP 569=MSN
  TCP 605=SecretService
  TCP 606=Noknok8
  TCP 660=DeepThroat
  TCP 661=Noknok8
  TCP 666=Attack FTP,Satanz Backdoor,Back Construction,Dark Connection Inside 1.2
  TCP 667=Noknok7.2
  TCP 668=Noknok6
  TCP 669=DP trojan
  TCP 692=GayOL
  TCP 707=Welchia,nachi
  TCP 777=AIM Spy
  TCP 808=RemoteControl,WinHole
  TCP 815=Everyone Darling
  TCP 901=Backdoor.Devil
  TCP 911=Dark Shadow
  TCP 990=ssl加密
  TCP 993=IMAP
  TCP 999=DeepThroat
  TCP 1000=Der Spaeher
  TCP 1001=Silencer,WebEx,Der Spaeher
  TCP 1003=BackDoor
  TCP 1010=Doly
  TCP 1011=Doly
  TCP 1012=Doly
  TCP 1015=Doly
  TCP 1016=Doly
  TCP 1020=Vampire
  TCP 1023=Worm.Sasser.e
  TCP 1024=NetSpy.698(YAI)

  2二、动态端口获取
  TCP 1059=nimreg
  TCP 1025=NetSpy.698,Unused Windows Services Block
  TCP 1026=Unused Windows Services Block
  TCP 1027=Unused Windows Services Block
  TCP 1028=Unused Windows Services Block
  TCP 1029=Unused Windows Services Block
  TCP 1030=Unused Windows Services Block
  TCP 1033=Netspy
  TCP 1035=Multidropper
  TCP 1042=Bla
  TCP 1045=Rasmin
  TCP 1047=GateCrasher
  TCP 1050=MiniCommand
  TCP 1069=Backdoor.TheefServer.202
  TCP 1070=Voice,Psyber Stream Server,Streaming Audio Trojan
  TCP 1080=Wingate,Worm.BugBear.B,Worm.Novarg.B
  TCP 1090=Xtreme, VDOLive
  TCP 1092=LoveGate
  TCP 1095=Rat
  TCP 1097=Rat
  TCP 1098=Rat
  TCP 1099=Rat
  TCP 1110=nfsd-keepalive
  TCP 1111=Backdoor.AIMVision
  TCP 1155=Network File Access
  TCP 1170=Psyber Stream Server,Streaming Audio trojan,Voice
  TCP 1200=NoBackO
  TCP 1201=NoBackO
  TCP 1207=Softwar
  TCP 1212=Nirvana,Visul Killer
  TCP 1234=Ultors
  TCP 1243=BackDoor-G, SubSeven, SubSeven Apocalypse
  TCP 1245=VooDoo Doll
  TCP 1269=Mavericks Matrix
  TCP 1313=Nirvana
  TCP 1349=BioNet
  TCP 1433=Microsoft SQL服务
  TCP 1441=Remote Storm
  TCP 1492=FTP99CMP(BackOriffice.FTP)
  TCP 1503=NetMeeting T.120
  TCP 1509=Psyber Streaming Server
  TCP 1600=Shivka-Burka
  TCP 1703=Exloiter 1.1
  TCP 1720=NetMeeting H.233 call Setup
  TCP 1731=NetMeeting音频调用控制
  TCP 1807=SpySender
  TCP 1966=Fake FTP 2000
  TCP 1976=Custom port
  TCP 1981=Shockrave
  TCP 1990=stun-p1 cisco STUN Priority 1 port
  TCP 1990=stun-p1 cisco STUN Priority 1 port
  TCP 1991=stun-p2 cisco STUN Priority 2 port
  TCP 1992=stun-p3 cisco STUN Priority 3 port,ipsendmsg IPsendmsg
  TCP 1993=snmp-tcp-port cisco SNMP TCP port
  TCP 1994=stun-port cisco serial tunnel port
  TCP 1995=perf-port cisco perf port
  TCP 1996=tr-rsrb-port cisco Remote SRB port
  TCP 1997=gdp-port cisco Gateway Discovery Protocol
  TCP 1998=x25-svc-port cisco X.25 service (XOT)
  TCP 1999=BackDoor, TransScout
  TCP 2000=Der Spaeher,INsane Network
  TCP 2002=W32.Beagle. AX mm
  TCP 2001=Transmisson scout
  TCP 2002=Transmisson scout
  TCP 2003=Transmisson scout
  TCP 2004=Transmisson scout
  TCP 2005=TTransmisson scout
  TCP 2011=cypress
  TCP 2015=raid-cs
  TCP 2023=Ripper,Pass Ripper,Hack City Ripper Pro
  TCP 2049=NFS
  TCP 2115=Bugs
  TCP 2121=Nirvana
  TCP 2140=Deep Throat, The Invasor
  TCP 2155=Nirvana
  TCP 2208=RuX
  TCP 2255=Illusion Mailer
  TCP 2283=HVL Rat5
  TCP 2300=PC Explorer
  TCP 2311=Studio54
  TCP 2556=Worm.Bbeagle.q
  TCP 2565=Striker
  TCP 3210=SchoolBus
  TCP 3332=Worm.Cycle.a
  TCP 3333=Prosiak
  TCP 3389=超级终端
  TCP 3456=Terror
  TCP 3459=Eclipse 2000
  TCP 3700=Portal of Doom
  TCP 4500=W32.HLLW.Tufas
  TCP 5190=ICQ Query
  TCP 5321=Firehotcker
  TCP 5333=Backage Trojan Box 3
  TCP 5343=WCrat
  TCP 5400=Blade Runner, BackConstruction1.2
  TCP 5401=Blade Runner,Back Construction
  TCP 5402=Blade Runner,Back Construction
  TCP 5471=WinCrash
  TCP 5512=Illusion Mailer
  TCP 5521=Illusion Mailer
  TCP 5550=Xtcp,INsane Network
  TCP 5554=Worm.Sasser
  TCP 5555=ServeMe
  TCP 5556=BO Facil
  TCP 5557=BO Facil
  TCP 5569=Robo-Hack
  TCP 5598=BackDoor 2.03
  TCP 5631=PCAnyWhere data
  TCP 5632=PCAnyWhere
  TCP 5637=PC Crasher
  TCP 5638=PC Crasher
  TCP 5698=BackDoor
  TCP 5714=Wincrash3
  TCP 5741=WinCrash3
  TCP 5742=WinCrash
  TCP 5760=Portmap Remote Root Linux Exploit
  TCP 5880=Y3K RAT
  TCP 5881=Y3K RAT
  TCP 5882=Y3K RAT
  TCP 5888=Y3K RAT
  TCP 5889=Y3K RAT
  TCP 5900=WinVnc
  TCP 6000=Backdoor.AB
  TCP 6006=Noknok8
  TCP 6129=Dameware Nt Utilities服务器
  TCP 6272=SecretService
  TCP 6267=广外女生
  TCP 6400=Backdoor.AB,The Thing
  TCP 6500=Devil 1.03
  TCP 6661=Teman
  TCP 6666=TCPshell.c
  TCP 6667=NT Remote Control,Wise 播放器接收端口
  TCP 6668=Wise Video广播端口
  TCP 6669=Vampyre
  TCP 6670=DeepThroat,iPhone
  TCP 6671=Deep Throat 3.0
  TCP 6711=SubSeven
  TCP 6712=SubSeven1.x
  TCP 6713=SubSeven
  TCP 6723=Mstream
  TCP 6767=NT Remote Control
  TCP 6771=DeepThroat
  TCP 6776=BackDoor-G,SubSeven,2000 Cracks
  TCP 6777=Worm.BBeagle
  TCP 6789=Doly Trojan
  TCP 6838=Mstream
  TCP 6883=DeltaSource
  TCP 6912=Shit Heep
  TCP 6939=Indoctrination
  TCP 6969=GateCrasher, Priority, IRC 3
  TCP 6970=RealAudio,GateCrasher
  TCP 7000=Remote Grab,NetMonitor,SubSeven1.x
  TCP 7001=Freak88
  TCP 7201=NetMonitor
  TCP 7215=BackDoor-G, SubSeven
  TCP 7001=Freak88,Freak2k
  TCP 7300=NetMonitor
  TCP 7301=NetMonitor
  TCP 7306=NetMonitor,NetSpy 1.0
  TCP 7307=NetMonitor, ProcSpy
  TCP 7308=NetMonitor, X Spy
  TCP 7323=Sygate服务器端
  TCP 7424=Host Control
  TCP 7511=聪明基因
  TCP 7597=Qaz
  TCP 7609=Snid X2
  TCP 7626=冰河
  TCP 7777=The Thing
  TCP 7789=Back Door Setup, ICQKiller
  TCP 7983=Mstream
  TCP 8000=腾讯OICQ服务器端,XDMA
  TCP 8010=Wingate,Logfile
  TCP 8011=WAY2.4
  TCP 8080=WWW 代理,Ring Zero,Chubo,Worm.Novarg.B
  TCP 8102=网络神偷
  TCP 8181=W32.Erkez.Dmm
  TCP 8520=W32.Socay.Worm
  TCP 8594=I-Worm/Bozori.a
  TCP 8787=BackOfrice 2000
  TCP 8888=Winvnc
  TCP 8897=Hack Office,Armageddon
  TCP 8989=Recon
  TCP 9000=Netministrator
  TCP 9325=Mstream
  TCP 9400=InCommand 1.0
  TCP 9401=InCommand 1.0
  TCP 9402=InCommand 1.0
  TCP 9872=Portal of Doom
  TCP 9873=Portal of Doom
  TCP 9874=Portal of Doom
  TCP 9875=Portal of Doom
  TCP 9876=Cyber Attacker
  TCP 9878=TransScout
  TCP 9989=Ini-Killer
  TCP 9898=Worm.Win32.Dabber.a
  TCP 9999=Prayer Trojan
  TCP 10000=webmin管理端口
  TCP 10067=Portal of Doom
  TCP 10080=Worm.Novarg.B
  TCP 10084=Syphillis
  TCP 10085=Syphillis
  TCP 10086=Syphillis
  TCP 10101=BrainSpy
  TCP 10167=Portal Of Doom
  TCP 10168=Worm.Supnot.78858.c,Worm.LovGate.T
  TCP 10520=Acid Shivers
  TCP 10607=Coma trojan
  TCP 10666=Ambush
  TCP 11000=Senna Spy
  TCP 11050=Host Control
  TCP 11051=Host Control
  TCP 11223=Progenic,Hack ’99KeyLogger
  TCP 11831=TROJ_LATINUS.SVR
  TCP 12076=Gjamer, MSH.104b
  TCP 12223=Hack’99 KeyLogger
  TCP 12345=GabanBus, NetBus 1.6/1.7, Pie Bill Gates, X-bill
  TCP 12346=GabanBus, NetBus 1.6/1.7, X-bill
  TCP 12349=BioNet
  TCP 12361=Whack-a-mole
  TCP 12362=Whack-a-mole
  TCP 12363=Whack-a-mole
  TCP 12378=W32/GibeM
  TCP 12456=NetBus
  TCP 12623=DUN Control
  TCP 12624=Buttman
  TCP 12631=WhackJob, WhackJob.NB1.7
  TCP 12701=Eclipse2000
  TCP 12754=Mstream
  TCP 13000=Senna Spy
  TCP 13010=Hacker Brazil
  TCP 13013=Psychward
  TCP 13223=Tribal Voice的聊天程序PowWow
  TCP 13700=Kuang2 The Virus
  TCP 14456=Solero
  TCP 14500=PC Invader
  TCP 14501=PC Invader
  TCP 14502=PC Invader
  TCP 14503=PC Invader
  TCP 15000=NetDaemon 1.0
  TCP 15092=Host Control
  TCP 15104=Mstream
Storm代理
2023-07-25 广告
StormProxies是一家国内优质海外HTTP代理商,拥有一个庞大的IP资源池,覆盖200多个地区,IP数量大且匿名度高。其优点还包括超高并发、稳定高效、技术服务等特点,同时提供HTTP、HTTPS以及SOCKS5协议支持。此外,Sto... 点击进入详情页
本回答由Storm代理提供
yajiedesign
2014-03-05 · TA获得超过286个赞
知道小有建树答主
回答量:479
采纳率:0%
帮助的人:310万
展开全部
在连接建立以后 getsockname可取得本地的连接信息.包括端口号.
追问
能给个例程么
追答

见附件

本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式