Source Code Cross Referenced for NonblockingMulticastSocket.java in  » Web-Server » Rimfaxe-Web-Server » seda » nbio » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Server » Rimfaxe Web Server » seda.nbio 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:         * Copyright (c) 2001 by The Regents of the University of California. 
003:         * All rights reserved.
004:         *
005:         * Permission to use, copy, modify, and distribute this software and its
006:         * documentation for any purpose, without fee, and without written agreement is
007:         * hereby granted, provided that the above copyright notice and the following
008:         * two paragraphs appear in all copies of this software.
009:         * 
010:         * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
011:         * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
012:         * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
013:         * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
014:         * 
015:         * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
016:         * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
017:         * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
018:         * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
019:         * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
020:         *
021:         * Author: Rob von Behren <jrvb@cs.berkeley.edu>
022:         * 
023:         */
024:
025:        package seda.nbio;
026:
027:        import java.io.*;
028:        import java.net.*;
029:
030:        /**
031:         * NonblockingMulticastSocket provides non-blocking multicast datagram I/O.
032:         *
033:         * NOTE: packets cannot be received on a socket once connect() is
034:         * called, due to the semantics of connect() for multicast sockets.
035:         * Instead, applications should generally use joinGroup(), and then
036:         * explicitly specify the group address as the destination in all the
037:         * outbound packets.
038:         **/
039:        public class NonblockingMulticastSocket extends
040:                NonblockingDatagramSocket {
041:
042:            InetAddress multicast_interface = null;
043:            int multicast_ttl = -1;
044:
045:            /**
046:             * Create a NonblockingMulticastSocket bound to any available port. 
047:             */
048:            public NonblockingMulticastSocket() throws IOException {
049:                /* bind socket to any available port */
050:                this (0, null);
051:            }
052:
053:            public NonblockingMulticastSocket(int port) throws IOException {
054:                this (port, null);
055:            }
056:
057:            /**
058:             * Create a NonblockingMulticastSocket bound to the given port and
059:             * the given local address.
060:             */
061:            public NonblockingMulticastSocket(int port, InetAddress laddr)
062:                    throws IOException {
063:                super (port, laddr);
064:            }
065:
066:            /**
067:             * Join a multicast group
068:             **/
069:            public void joinGroup(InetAddress addr) throws IOException {
070:                impl.joinGroup(addr);
071:            }
072:
073:            /**
074:             * Leave a multicast group
075:             **/
076:            public void leaveGroup(InetAddress addr) throws IOException {
077:                impl.leaveGroup(addr);
078:            }
079:
080:            /**
081:             * get the multicast ttl
082:             **/
083:            public int getTimeToLive() throws IOException {
084:                if (multicast_ttl == -1)
085:                    multicast_ttl = impl.getTimeToLive();
086:
087:                return multicast_ttl;
088:            }
089:
090:            /**
091:             * set the time to live
092:             **/
093:            public void setTimeToLive(int ttl) throws IOException {
094:                multicast_ttl = ttl;
095:                impl.setTimeToLive(ttl);
096:            }
097:
098:            /**
099:             * Get the interface associated with this multicast socket
100:             **/
101:            public InetAddress getInterface() {
102:                // FIXME: this is done, b/c it is easier than creating the new
103:                // object from w/in the Jni layer.  This is probably faster
104:                // anyway, so this should be OK.
105:                return multicast_interface;
106:            }
107:
108:            /**
109:             * Set the interface associated with this socket
110:             **/
111:            public void setInterface(InetAddress addr) throws IOException {
112:                impl.setInterface(addr);
113:            }
114:
115:            /**
116:             * This sets the state of the IP_MULTICAST_LOOP option on the
117:             * underlying socket.  If state==true, the socket will receive
118:             * packets it sends out.  If false, it will not.<p>
119:             *
120:             * NOTE: The behavior of this is somewhat strange for two multicast
121:             * listeners on the same physical machine.  Ideally, this should be
122:             * an incoming filter - each socket should throw out packets that it
123:             * sent out, and not deliver them to the application.<p>
124:             * 
125:             * Unfortunately, this instead seems to be an outbound filter - all
126:             * packets sent out on a socket with IP_MULTICAST_LOOP turned off
127:             * will be invisible to all sockets on the local machine -
128:             * regardless of whether or not these other sockets have specified
129:             * IP_MULTICAST_LOOP=false.
130:             **/
131:            public void seeLocalMessages(boolean state) throws IOException {
132:                impl.seeLocalMessages(state);
133:            }
134:
135:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.