Click to See Complete Forum and Search --> : can i use same ip and port in 2 application
itenggnaveen
July 5th, 2010, 04:20 AM
hi, i m new to socket programming, if suppose i created application(xp) with some port and ip for send and receive and this app is running. and then if i create 2nd app can i use same ip and port using in 1st app. or if only port is same in both app, or if only ip is same in both app, then it will work. i want to know in both cases (TCP and UDP)
ahmd
July 5th, 2010, 07:24 PM
Depending on the implementation, say for TCP when you attempt to bind a socket when it's already bound it may produce an error if SO_EXCLUSIVEADDRUSE flag was used. But, even if you succeed in opening your sockets with the same ports in two or more processes, besides an obvious need for some sort of synchronization, it poses a big security risk, because an attacker can technically do the same with your program. Read more here:
http://msdn.microsoft.com/en-us/library/ms740621%28v=VS.85%29.aspx
The question is why do you need to use the same port for two applications?
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.