KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > providers > udp > UdpConnector


1 /*
2  * $Id: UdpConnector.java 3798 2006-11-04 04:07:14Z aperepel $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.providers.udp;
12
13 import org.mule.providers.AbstractServiceEnabledConnector;
14
15 /**
16  * <code>UdpConnector</code> can send and receive Mule events as Datagram packets.
17  */

18 public class UdpConnector extends AbstractServiceEnabledConnector
19 {
20     public static final int DEFAULT_SOCKET_TIMEOUT = 5000;
21     public static final int DEFAULT_BUFFER_SIZE = 64 * 1024;
22
23     private int timeout = DEFAULT_SOCKET_TIMEOUT;
24     private int bufferSize = DEFAULT_BUFFER_SIZE;
25
26     public String JavaDoc getProtocol()
27     {
28         return "UDP";
29     }
30
31     public int getTimeout()
32     {
33         return timeout;
34     }
35
36     public void setTimeout(int timeout)
37     {
38         if (timeout < 1)
39         {
40             timeout = DEFAULT_SOCKET_TIMEOUT;
41         }
42         this.timeout = timeout;
43     }
44
45     public int getBufferSize()
46     {
47         return bufferSize;
48     }
49
50     public void setBufferSize(int bufferSize)
51     {
52         if (bufferSize < 1)
53         {
54             bufferSize = DEFAULT_BUFFER_SIZE;
55         }
56         this.bufferSize = bufferSize;
57     }
58
59 }
60
Popular Tags