Meaningless Drivel is fun!*
The moose likes Sockets and Internet Protocols and the fly likes Security in Datagrams Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Security in Datagrams" Watch "Security in Datagrams" New topic
Author

Security in Datagrams

H Melua
Ranch Hand

Joined: Jan 04, 2005
Posts: 172
Hello, its been ages

I'm in the process of understanding Datagrams, and i understand that it is connectionless protocol...
so my question is, if i send some data to a server, and leave that socket open for continuous listening, can an unauthorized host spam my socket?

In Java will it though any kind of exception to reject data from the unauthorized host?

hope the questions are clear
thanks
HannaH
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41106
    
  45
No, a Socket isn't vulnerable to that. A ServerSocket is open for listening to anyone who wants to connect, but a Socket is used only for connections to a particular port on a particular host. No other host can connect to it.


Ping & DNS - my free Android networking tools app
H Melua
Ranch Hand

Joined: Jan 04, 2005
Posts: 172
Thanks Ulf very much

I particularly meant, DatagramSocket

is that the same as ServerSocket?

and when you say a "ServerSocket is open for anyone to connect" doesn't that mean an unauthorized one can connect to my host?
[ February 20, 2008: Message edited by: H Melua ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41106
    
  45
I particularly meant, DatagramSocket

is that the same as ServerSocket?

No. A ServerSocket uses TCP, not UDP like DatagramSocket.

and when you say a "ServerSocket is open for anyone to connect" doesn't that mean an unauthorized one can connect to my host?

That's exactly what it means. You need to implement authentication and authorization yourself if you use raw sockets.
H Melua
Ranch Hand

Joined: Jan 04, 2005
Posts: 172
cheers very much for the info, it sounds very interesting

 
jQuery in Action, 2nd edition
 
subject: Security in Datagrams
 
Similar Threads
Urgent! Last character is lost in datagrams
Sending data to an applet.
JDK 1.5_0_5 PrinterWriter.readLine() is splitting data?
how to decide whether to go with socket or web service
Socket connections