Package gurux.net
Class GXNet
java.lang.Object
gurux.net.GXNet
- All Implemented Interfaces:
gurux.common.IGXMedia,gurux.common.IGXMedia2,AutoCloseable
The GXNet component determines methods that make the communication possible
using Internet.
-
Constructor Summary
ConstructorsConstructorDescriptionGXNet()Constructor.GXNet(NetworkType networkType, int portNo)Constructor used when server is started.GXNet(NetworkType networkType, String name, int portNo)Client Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaboutBox()Displays the copyright of the control, user license, and version information, in a dialog box.voidaddListener(gurux.common.IGXMediaListener listener)Attach TCP/IP connection.voidclose()voidprotected voidfinalize()Destructor.intlongReceived byte count.longSent byte count.intintGets how long (milliseconds) server answer is waited when connection is made.getEop()Retrieves the name or IP address of the host.booleanintRetrieves maximum count of connected clients.getName()intgetPort()Retrieves or sets the host or server port number.Retrieves the used protocol.intbooleanIs server mode used.Media settings as a XML string.gurux.common.enums.TraceLevelgetTrace()booleanisOpen()voidopen()Opens the connection.booleanproperties(JFrame parent)<T> booleanreceive(gurux.common.ReceiveParameters<T> args)voidremoveListener(gurux.common.IGXMediaListener listener)voidResets BytesReceived and BytesSent counters.voidvoidvoidsetAsyncWaitTime(int value)voidsetConfigurableSettings(int value)voidsetConnectionWaitTime(int value)Sets how long (milliseconds) server answer is waited when connection is made.voidvoidsetHostName(String value)Sets the name or IP address of the host.voidvoidsetMaxClientCount(int value)Sets maximum count of connected clients.voidsetPort(int value)Retrieves or sets the host or server port number.voidsetProtocol(NetworkType value)Sets the used protocol.voidsetReceiveDelay(int value)voidsetServer(boolean value)Is server mode used.voidsetSettings(String value)voidsetTrace(gurux.common.enums.TraceLevel value)voidvalidate()
-
Constructor Details
-
GXNet
public GXNet()Constructor. -
GXNet
Client Constructor.- Parameters:
networkType- Used protocol.name- Host name.portNo- Client port number.
-
GXNet
Constructor used when server is started.- Parameters:
networkType- Used protocol.portNo- Server port.
-
-
Method Details
-
attach
Attach TCP/IP connection. This can be used in server side if server want to start communicating with client using synchronous communication. Close connection after use.- Parameters:
address- cliend address to connect.- Returns:
- Attached connection.
-
finalize
Destructor. -
getTrace
public final gurux.common.enums.TraceLevel getTrace()- Specified by:
getTracein interfacegurux.common.IGXMedia
-
setTrace
public final void setTrace(gurux.common.enums.TraceLevel value)- Specified by:
setTracein interfacegurux.common.IGXMedia
-
getConfigurableSettings
public final int getConfigurableSettings()- Specified by:
getConfigurableSettingsin interfacegurux.common.IGXMedia
-
setConfigurableSettings
public final void setConfigurableSettings(int value)- Specified by:
setConfigurableSettingsin interfacegurux.common.IGXMedia
-
properties
- Specified by:
propertiesin interfacegurux.common.IGXMedia
-
aboutBox
public final void aboutBox()Displays the copyright of the control, user license, and version information, in a dialog box. -
send
- Specified by:
sendin interfacegurux.common.IGXMedia- Parameters:
target- IP address of the receiver (optional). Reply data is received through OnReceived event.- Throws:
Exception
-
open
Opens the connection. Protocol, Port and HostName must be set, before calling the Open method. -
close
public final void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfacegurux.common.IGXMedia
-
isOpen
public final boolean isOpen()- Specified by:
isOpenin interfacegurux.common.IGXMedia
-
getProtocol
Retrieves the used protocol.- Returns:
- Protocol in use.
-
setProtocol
Sets the used protocol.- Parameters:
value- Used protocol.
-
getHostName
Retrieves the name or IP address of the host.- Returns:
- The name of the host.
- See Also:
open(),port,protocol
-
setHostName
Sets the name or IP address of the host.- Parameters:
value- The name of the host.
-
getPort
public final int getPort()Retrieves or sets the host or server port number.- Returns:
- Host or server port number.
- See Also:
open(),hostName,protocol
-
setPort
public final void setPort(int value)Retrieves or sets the host or server port number.- Parameters:
value- Host or server port number- See Also:
open(),hostName,protocol
-
getServer
public final boolean getServer()Is server mode used.- Returns:
- Is server mode used.
- See Also:
open()
-
setServer
public final void setServer(boolean value)Is server mode used.- Parameters:
value- Is server mode used.- See Also:
open()
-
getConnectionWaitTime
public final int getConnectionWaitTime()Gets how long (milliseconds) server answer is waited when connection is made. Operating system time is used if value is zero.- Returns:
- Wait time in milliseconds.
-
setConnectionWaitTime
public final void setConnectionWaitTime(int value)Sets how long (milliseconds) server answer is waited when connection is made. Operating system time is used if value is zero.- Parameters:
value- Wait time in milliseconds.
-
receive
public final <T> boolean receive(gurux.common.ReceiveParameters<T> args)- Specified by:
receivein interfacegurux.common.IGXMedia
-
getBytesSent
public final long getBytesSent()Sent byte count.- Specified by:
getBytesSentin interfacegurux.common.IGXMedia- See Also:
getBytesReceived(),resetByteCounters()
-
getBytesReceived
public final long getBytesReceived()Received byte count.- Specified by:
getBytesReceivedin interfacegurux.common.IGXMedia- See Also:
bytesSent,resetByteCounters()
-
resetByteCounters
public final void resetByteCounters()Resets BytesReceived and BytesSent counters.- Specified by:
resetByteCountersin interfacegurux.common.IGXMedia- See Also:
bytesSent,getBytesReceived()
-
getMaxClientCount
public final int getMaxClientCount()Retrieves maximum count of connected clients.- Returns:
- Maximum count of connected clients.
-
setMaxClientCount
public final void setMaxClientCount(int value)Sets maximum count of connected clients.- Parameters:
value- Maximum count of connected clients.
-
getSettings
Media settings as a XML string.- Specified by:
getSettingsin interfacegurux.common.IGXMedia
-
setSettings
- Specified by:
setSettingsin interfacegurux.common.IGXMedia
-
copy
- Specified by:
copyin interfacegurux.common.IGXMedia
-
getName
- Specified by:
getNamein interfacegurux.common.IGXMedia
-
getMediaType
- Specified by:
getMediaTypein interfacegurux.common.IGXMedia
-
getSynchronous
- Specified by:
getSynchronousin interfacegurux.common.IGXMedia
-
getIsSynchronous
public final boolean getIsSynchronous()- Specified by:
getIsSynchronousin interfacegurux.common.IGXMedia
-
resetSynchronousBuffer
public final void resetSynchronousBuffer()- Specified by:
resetSynchronousBufferin interfacegurux.common.IGXMedia
-
validate
public final void validate()- Specified by:
validatein interfacegurux.common.IGXMedia
-
getEop
- Specified by:
getEopin interfacegurux.common.IGXMedia
-
setEop
- Specified by:
setEopin interfacegurux.common.IGXMedia
-
addListener
public final void addListener(gurux.common.IGXMediaListener listener)- Specified by:
addListenerin interfacegurux.common.IGXMedia
-
removeListener
public final void removeListener(gurux.common.IGXMediaListener listener)- Specified by:
removeListenerin interfacegurux.common.IGXMedia
-
getReceiveDelay
public int getReceiveDelay()- Specified by:
getReceiveDelayin interfacegurux.common.IGXMedia2
-
setReceiveDelay
public void setReceiveDelay(int value)- Specified by:
setReceiveDelayin interfacegurux.common.IGXMedia2
-
getAsyncWaitTime
public int getAsyncWaitTime()- Specified by:
getAsyncWaitTimein interfacegurux.common.IGXMedia2
-
setAsyncWaitTime
public void setAsyncWaitTime(int value)- Specified by:
setAsyncWaitTimein interfacegurux.common.IGXMedia2
-
getAsyncWaitHandle
- Specified by:
getAsyncWaitHandlein interfacegurux.common.IGXMedia2
-
getLocale
-
setLocale
-