mirror of
https://github.com/twiglet/cs2j.git
synced 2025-01-18 13:15:17 +01:00
minimal support for client/server socket
This commit is contained in:
parent
0ed1e625d8
commit
a654e0d694
45
CS2JLibrary/NetFramework/System/Net/EndPoint.xml
Normal file
45
CS2JLibrary/NetFramework/System/Net/EndPoint.xml
Normal file
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
This file is
|
||||
|
||||
Copyright 2007,2008,2009,2010 Rustici Software, LLC
|
||||
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
|
||||
-->
|
||||
<Class xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:www.twigletsoftware.com:schemas:txtemplate:1:0">
|
||||
<Imports>
|
||||
<Import>CS2JNet.System.Net.EndPoint</Import>
|
||||
</Imports>
|
||||
<Java>EndPoint</Java>
|
||||
<Name>System.Net.EndPoint</Name>
|
||||
<Uses />
|
||||
<Inherits>
|
||||
<Type>System.Object</Type>
|
||||
</Inherits>
|
||||
<Methods>
|
||||
</Methods>
|
||||
<Properties>
|
||||
<Property>
|
||||
<Type>System.Net.Sockets.AddressFamily</Type>
|
||||
<Name>AddressFamily</Name>
|
||||
<Get>${this:16}.getAddressFamily()</Get>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events />
|
||||
<Indexers />
|
||||
<Constructors>
|
||||
<Constructor>
|
||||
<Params>
|
||||
</Params>
|
||||
<Imports>
|
||||
<Import>CS2JNet.System.Net.EndPoint</Import>
|
||||
</Imports>
|
||||
<Java>new EndPoint()</Java>
|
||||
</Constructor>
|
||||
</Constructors>
|
||||
<Fields />
|
||||
<Casts />
|
||||
<UnaryOps />
|
||||
<BinaryOps />
|
||||
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue>SN3u4jP6NT27ku+roqFb8+ai8ss=</DigestValue></Reference></SignedInfo><SignatureValue>IDeU7DwlyrEORnFANQXDU9BSzSqxdUghEJlNqR97r026Ia06GJcmTEXLJrOZPrImgzMHmRYbc3pnd1F/6C02D1GphfR/JkDcC/k+3K6OMiXyv+o2R5bOourI8ysEUap+KLwBYAOhwRW9ZRix1KnfPD2yBO+Pd11oMA/JyuuDNoI=</SignatureValue></Signature></Class>
|
52
CS2JLibrary/NetFramework/System/Net/IPAddress.xml
Normal file
52
CS2JLibrary/NetFramework/System/Net/IPAddress.xml
Normal file
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
This file is
|
||||
|
||||
Copyright 2007,2008,2009,2010 Rustici Software, LLC
|
||||
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
|
||||
-->
|
||||
<Class xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:www.twigletsoftware.com:schemas:txtemplate:1:0">
|
||||
<Imports>
|
||||
<Import>CS2JNet.System.Net.IPAddress</Import>
|
||||
</Imports>
|
||||
<Java>IPAddress</Java>
|
||||
<Name>System.Net.IPAddress</Name>
|
||||
<Uses />
|
||||
<Inherits>
|
||||
<Type>System.Object</Type>
|
||||
</Inherits>
|
||||
<Methods>
|
||||
</Methods>
|
||||
<Properties />
|
||||
<Events />
|
||||
<Indexers />
|
||||
<Constructors>
|
||||
<Constructor>
|
||||
<Params>
|
||||
<Param>
|
||||
<Type>System.Int64</Type>
|
||||
<Name>newAddress</Name>
|
||||
</Param>
|
||||
</Params>
|
||||
<Imports>
|
||||
<Import>CS2JNet.System.Net.IPAddress</Import>
|
||||
</Imports>
|
||||
<Java>new IPAddress(${newAddress})</Java>
|
||||
</Constructor>
|
||||
</Constructors>
|
||||
<Fields>
|
||||
<Field>
|
||||
<Imports>
|
||||
<Import>CS2JNet.System.Net.IPAddress</Import>
|
||||
</Imports>
|
||||
<Type>System.Net.IPAddress</Type>
|
||||
<Name>Any</Name>
|
||||
<Java>IPAddress.Any</Java>
|
||||
</Field>
|
||||
</Fields>
|
||||
<Casts />
|
||||
<UnaryOps />
|
||||
<BinaryOps />
|
||||
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue>SN3u4jP6NT27ku+roqFb8+ai8ss=</DigestValue></Reference></SignedInfo><SignatureValue>IDeU7DwlyrEORnFANQXDU9BSzSqxdUghEJlNqR97r026Ia06GJcmTEXLJrOZPrImgzMHmRYbc3pnd1F/6C02D1GphfR/JkDcC/k+3K6OMiXyv+o2R5bOourI8ysEUap+KLwBYAOhwRW9ZRix1KnfPD2yBO+Pd11oMA/JyuuDNoI=</SignatureValue></Signature></Class>
|
60
CS2JLibrary/NetFramework/System/Net/IPEndPoint.xml
Normal file
60
CS2JLibrary/NetFramework/System/Net/IPEndPoint.xml
Normal file
@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
This file is
|
||||
|
||||
Copyright 2007,2008,2009,2010 Rustici Software, LLC
|
||||
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
|
||||
-->
|
||||
<Class xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:www.twigletsoftware.com:schemas:txtemplate:1:0">
|
||||
<Imports>
|
||||
<Import>CS2JNet.System.Net.IPEndPoint</Import>
|
||||
</Imports>
|
||||
<Java>IPEndPoint</Java>
|
||||
<Name>System.Net.IPEndPoint</Name>
|
||||
<Uses />
|
||||
<Inherits>
|
||||
<Type>System.Net.EndPoint</Type>
|
||||
</Inherits>
|
||||
<Methods>
|
||||
</Methods>
|
||||
<Properties>
|
||||
<Property>
|
||||
<Type>System.Net.IPAddress</Type>
|
||||
<Name>Address</Name>
|
||||
<Get>${this:16}.getIPAddress()</Get>
|
||||
<Set>${this:16}.setIPAddress(${value})</Set>
|
||||
</Property>
|
||||
<Property>
|
||||
<Type>System.Int32</Type>
|
||||
<Name>Port</Name>
|
||||
<Get>${this:16}.getPort()</Get>
|
||||
<Set>${this:16}.setPort(${value})</Set>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events />
|
||||
<Indexers />
|
||||
<Constructors>
|
||||
<Constructor>
|
||||
<Params>
|
||||
<Param>
|
||||
<Type>System.Net.IPAddress</Type>
|
||||
<Name>address</Name>
|
||||
</Param>
|
||||
<Param>
|
||||
<Type>System.Int32</Type>
|
||||
<Name>port</Name>
|
||||
</Param>
|
||||
</Params>
|
||||
<Imports>
|
||||
<Import>CS2JNet.System.Net.IPEndPoint</Import>
|
||||
</Imports>
|
||||
<Java>new IPEndPoint(${address}, ${port})</Java>
|
||||
</Constructor>
|
||||
</Constructors>
|
||||
<Fields />
|
||||
<Casts />
|
||||
<UnaryOps />
|
||||
<BinaryOps />
|
||||
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue>SN3u4jP6NT27ku+roqFb8+ai8ss=</DigestValue></Reference></SignedInfo><SignatureValue>IDeU7DwlyrEORnFANQXDU9BSzSqxdUghEJlNqR97r026Ia06GJcmTEXLJrOZPrImgzMHmRYbc3pnd1F/6C02D1GphfR/JkDcC/k+3K6OMiXyv+o2R5bOourI8ysEUap+KLwBYAOhwRW9ZRix1KnfPD2yBO+Pd11oMA/JyuuDNoI=</SignatureValue></Signature></Class>
|
145
CS2JLibrary/NetFramework/System/Net/Sockets/AddressFamily.xml
Normal file
145
CS2JLibrary/NetFramework/System/Net/Sockets/AddressFamily.xml
Normal file
@ -0,0 +1,145 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
This file is
|
||||
|
||||
Copyright 2007,2008,2009,2010 Rustici Software, LLC
|
||||
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
|
||||
-->
|
||||
<Enum xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:www.twigletsoftware.com:schemas:txtemplate:1:0">
|
||||
<Imports>
|
||||
<Import>CS2JNet.System.Net.Sockets.AddressFamily</Import>
|
||||
</Imports>
|
||||
<Java>AddressFamily</Java>
|
||||
<Name>System.Net.Sockets.AddressFamily</Name>
|
||||
<Inherits>
|
||||
<Type>System.Enum</Type>
|
||||
</Inherits>
|
||||
<Members>
|
||||
<Member>
|
||||
<Java>${this:16}.Unknown</Java>
|
||||
<Name>Unknown</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Unspecified</Java>
|
||||
<Name>Unspecified</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Unix</Java>
|
||||
<Name>Unix</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.InterNetwork</Java>
|
||||
<Name>InterNetwork</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.ImpLink</Java>
|
||||
<Name>ImpLink</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Pup</Java>
|
||||
<Name>Pup</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Chaos</Java>
|
||||
<Name>Chaos</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.NS</Java>
|
||||
<Name>NS</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Ipx</Java>
|
||||
<Name>Ipx</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Iso</Java>
|
||||
<Name>Iso</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Osi</Java>
|
||||
<Name>Osi</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Ecma</Java>
|
||||
<Name>Ecma</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.DataKit</Java>
|
||||
<Name>DataKit</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Ccitt</Java>
|
||||
<Name>Ccitt</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Sna</Java>
|
||||
<Name>Sna</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.DecNet</Java>
|
||||
<Name>DecNet</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.DataLink</Java>
|
||||
<Name>DataLink</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Lat</Java>
|
||||
<Name>Lat</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.HyperChannel</Java>
|
||||
<Name>HyperChannel</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.AppleTalk</Java>
|
||||
<Name>AppleTalk</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.NetBios</Java>
|
||||
<Name>NetBios</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.VoiceView</Java>
|
||||
<Name>VoiceView</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.FireFox</Java>
|
||||
<Name>FireFox</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Banyan</Java>
|
||||
<Name>Banyan</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Atm</Java>
|
||||
<Name>Atm</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.InterNetworkV6</Java>
|
||||
<Name>InterNetworkV6</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Cluster</Java>
|
||||
<Name>Cluster</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Ieee12844</Java>
|
||||
<Name>Ieee12844</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Irda</Java>
|
||||
<Name>Irda</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.NetworkDesigners</Java>
|
||||
<Name>NetworkDesigners</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Max</Java>
|
||||
<Name>Max</Name>
|
||||
</Member>
|
||||
</Members>
|
||||
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue>efTWa4oLEWHXEL6YOzaqcIomFVo=</DigestValue></Reference></SignedInfo><SignatureValue>gg/i649hSZt7bAPM9ZB0QueDX8++7p7/Yzteb7h4p2YkRI22vMM2Lc+jI4lgxIB/Hf5Jd3XI0rGDRcDip2t4bV0ErQbPGTajuJncLj7RJ/BDpCA3nUBWZDYRmypxK/u3r1kf5aCAWQDZm0Bj6XlVK6+++Y+OG2PAkIpbngWlQQc=</SignatureValue></Signature></Enum>
|
121
CS2JLibrary/NetFramework/System/Net/Sockets/ProtocolType.xml
Normal file
121
CS2JLibrary/NetFramework/System/Net/Sockets/ProtocolType.xml
Normal file
@ -0,0 +1,121 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
This file is
|
||||
|
||||
Copyright 2007,2008,2009,2010 Rustici Software, LLC
|
||||
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
|
||||
-->
|
||||
<Enum xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:www.twigletsoftware.com:schemas:txtemplate:1:0">
|
||||
<Imports>
|
||||
<Import>CS2JNet.System.Net.Sockets.ProtocolType</Import>
|
||||
</Imports>
|
||||
<Java>ProtocolType</Java>
|
||||
<Name>System.Net.Sockets.ProtocolType</Name>
|
||||
<Inherits>
|
||||
<Type>System.Enum</Type>
|
||||
</Inherits>
|
||||
<Members>
|
||||
<Member>
|
||||
<Java>${this:16}.IP</Java>
|
||||
<Name>IP</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.IPv6HopByHopOptions</Java>
|
||||
<Name>IPv6HopByHopOptions</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Icmp</Java>
|
||||
<Name>Icmp</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Igmp</Java>
|
||||
<Name>Igmp</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Ggp</Java>
|
||||
<Name>Ggp</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.IPv4</Java>
|
||||
<Name>IPv4</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Tcp</Java>
|
||||
<Name>Tcp</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Pup</Java>
|
||||
<Name>Pup</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Udp</Java>
|
||||
<Name>Udp</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Idp</Java>
|
||||
<Name>Idp</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.IPv6</Java>
|
||||
<Name>IPv6</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.IPv6RoutingHeader</Java>
|
||||
<Name>IPv6RoutingHeader</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.IPv6FragmentHeader</Java>
|
||||
<Name>IPv6FragmentHeader</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.IPSecEncapsulatingSecurityPayload</Java>
|
||||
<Name>IPSecEncapsulatingSecurityPayload</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.IPSecAuthenticationHeader</Java>
|
||||
<Name>IPSecAuthenticationHeader</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.IcmpV6</Java>
|
||||
<Name>IcmpV6</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.IPv6NoNextHeader</Java>
|
||||
<Name>IPv6NoNextHeader</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.IPv6DestinationOptions</Java>
|
||||
<Name>IPv6DestinationOptions</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.ND</Java>
|
||||
<Name>ND</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Raw</Java>
|
||||
<Name>Raw</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Unspecified</Java>
|
||||
<Name>Unspecified</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Ipx</Java>
|
||||
<Name>Ipx</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Spx</Java>
|
||||
<Name>Spx</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.SpxII</Java>
|
||||
<Name>SpxII</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Unknown</Java>
|
||||
<Name>Unknown</Name>
|
||||
</Member>
|
||||
</Members>
|
||||
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue>efTWa4oLEWHXEL6YOzaqcIomFVo=</DigestValue></Reference></SignedInfo><SignatureValue>gg/i649hSZt7bAPM9ZB0QueDX8++7p7/Yzteb7h4p2YkRI22vMM2Lc+jI4lgxIB/Hf5Jd3XI0rGDRcDip2t4bV0ErQbPGTajuJncLj7RJ/BDpCA3nUBWZDYRmypxK/u3r1kf5aCAWQDZm0Bj6XlVK6+++Y+OG2PAkIpbngWlQQc=</SignatureValue></Signature></Enum>
|
188
CS2JLibrary/NetFramework/System/Net/Sockets/Socket.xml
Normal file
188
CS2JLibrary/NetFramework/System/Net/Sockets/Socket.xml
Normal file
@ -0,0 +1,188 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
This file is
|
||||
|
||||
Copyright 2007,2008,2009,2010 Rustici Software, LLC
|
||||
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
|
||||
-->
|
||||
<Class xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:www.twigletsoftware.com:schemas:txtemplate:1:0">
|
||||
<Imports>
|
||||
<Import>CS2JNet.System.Net.Sockets.NetSocket</Import>
|
||||
</Imports>
|
||||
<Java>NetSocket</Java>
|
||||
<Name>System.Net.Sockets.Socket</Name>
|
||||
<Uses />
|
||||
<Inherits>
|
||||
<Type>System.IDisposable</Type>
|
||||
</Inherits>
|
||||
<Methods>
|
||||
<Method>
|
||||
<Params>
|
||||
</Params>
|
||||
<Name>Accept</Name>
|
||||
<Return>System.Net.Sockets.Socket</Return>
|
||||
<Java>${this:16}.accept()</Java>
|
||||
</Method>
|
||||
<Method>
|
||||
<Params>
|
||||
<Param>
|
||||
<Type>System.Net.EndPoint</Type>
|
||||
<Name>localEP</Name>
|
||||
</Param>
|
||||
</Params>
|
||||
<Name>Bind</Name>
|
||||
<Return>System.Void</Return>
|
||||
<Java>${this:16}.bind(${localEP})</Java>
|
||||
</Method>
|
||||
<Method>
|
||||
<Params>
|
||||
</Params>
|
||||
<Name>Close</Name>
|
||||
<Return>System.Void</Return>
|
||||
<Java>${this:16}.close()</Java>
|
||||
</Method>
|
||||
<Method>
|
||||
<Params>
|
||||
<Param>
|
||||
<Type>System.Int32</Type>
|
||||
<Name>backLog</Name>
|
||||
</Param>
|
||||
</Params>
|
||||
<Name>Listen</Name>
|
||||
<Return>System.Void</Return>
|
||||
<Java>${this:16}.listen(${backLog})</Java>
|
||||
</Method>
|
||||
<Method>
|
||||
<Params>
|
||||
<Param>
|
||||
<Type>System.Byte[]</Type>
|
||||
<Name>buffer</Name>
|
||||
</Param>
|
||||
</Params>
|
||||
<Name>Receive</Name>
|
||||
<Return>System.Int32</Return>
|
||||
<Java>${this:16}.receive(${buffer})</Java>
|
||||
</Method>
|
||||
<Method>
|
||||
<Params>
|
||||
<Param>
|
||||
<Type>System.Byte[]</Type>
|
||||
<Name>buffer</Name>
|
||||
</Param>
|
||||
<Param>
|
||||
<Type>System.Net.Sockets.SocketFlags</Type>
|
||||
<Name>socketFlags</Name>
|
||||
</Param>
|
||||
</Params>
|
||||
<Name>Receive</Name>
|
||||
<Return>System.Int32</Return>
|
||||
<Java>${this:16}.receive(${buffer}, ${socketFlags})</Java>
|
||||
</Method>
|
||||
<Method>
|
||||
<Params>
|
||||
<Param>
|
||||
<Type>System.Byte[]</Type>
|
||||
<Name>buffer</Name>
|
||||
</Param>
|
||||
<Param>
|
||||
<Type>System.Int32</Type>
|
||||
<Name>size</Name>
|
||||
</Param>
|
||||
<Param>
|
||||
<Type>System.Net.Sockets.SocketFlags</Type>
|
||||
<Name>socketFlags</Name>
|
||||
</Param>
|
||||
</Params>
|
||||
<Name>Receive</Name>
|
||||
<Return>System.Int32</Return>
|
||||
<Java>${this:16}.receive(${buffer}, ${size}, ${socketFlags})</Java>
|
||||
</Method>
|
||||
<Method>
|
||||
<Params>
|
||||
<Param>
|
||||
<Type>System.Byte[]</Type>
|
||||
<Name>buffer</Name>
|
||||
</Param>
|
||||
</Params>
|
||||
<Name>Send</Name>
|
||||
<Return>System.Int32</Return>
|
||||
<Java>${this:16}.send(${buffer})</Java>
|
||||
</Method>
|
||||
<Method>
|
||||
<Params>
|
||||
<Param>
|
||||
<Type>System.Byte[]</Type>
|
||||
<Name>buffer</Name>
|
||||
</Param>
|
||||
<Param>
|
||||
<Type>System.Net.Sockets.SocketFlags</Type>
|
||||
<Name>socketFlags</Name>
|
||||
</Param>
|
||||
</Params>
|
||||
<Name>Send</Name>
|
||||
<Return>System.Int32</Return>
|
||||
<Java>${this:16}.send(${buffer}, ${socketFlags})</Java>
|
||||
</Method>
|
||||
<Method>
|
||||
<Params>
|
||||
<Param>
|
||||
<Type>System.Byte[]</Type>
|
||||
<Name>buffer</Name>
|
||||
</Param>
|
||||
<Param>
|
||||
<Type>System.Int32</Type>
|
||||
<Name>size</Name>
|
||||
</Param>
|
||||
<Param>
|
||||
<Type>System.Net.Sockets.SocketFlags</Type>
|
||||
<Name>socketFlags</Name>
|
||||
</Param>
|
||||
</Params>
|
||||
<Name>Send</Name>
|
||||
<Return>System.Int32</Return>
|
||||
<Java>${this:16}.send(${buffer}, ${size}, ${socketFlags})</Java>
|
||||
</Method>
|
||||
</Methods>
|
||||
<Properties>
|
||||
<Property>
|
||||
<Type>System.Net.EndPoint</Type>
|
||||
<Name>RemoteEndPoint</Name>
|
||||
<Get>${this:16}.getRemoteEndPoint()</Get>
|
||||
</Property>
|
||||
<Property>
|
||||
<Type>System.Net.EndPoint</Type>
|
||||
<Name>LocalEndPoint</Name>
|
||||
<Get>${this:16}.getLocalEndPoint()</Get>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events />
|
||||
<Indexers />
|
||||
<Constructors>
|
||||
<Constructor>
|
||||
<Params>
|
||||
<Param>
|
||||
<Type>System.Net.Sockets.AddressFamily</Type>
|
||||
<Name>addressFamily</Name>
|
||||
</Param>
|
||||
<Param>
|
||||
<Type>System.Net.Sockets.SocketType</Type>
|
||||
<Name>socketType</Name>
|
||||
</Param>
|
||||
<Param>
|
||||
<Type>System.Net.Sockets.ProtocolType</Type>
|
||||
<Name>protocolType</Name>
|
||||
</Param>
|
||||
</Params>
|
||||
<Imports>
|
||||
<Import>CS2JNet.System.Net.Sockets.NetSocket</Import>
|
||||
</Imports>
|
||||
<Java>new NetSocket(${addressFamily}, ${socketType}, ${protocolType})</Java>
|
||||
</Constructor>
|
||||
</Constructors>
|
||||
<Fields />
|
||||
<Casts />
|
||||
<UnaryOps />
|
||||
<BinaryOps />
|
||||
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue>SN3u4jP6NT27ku+roqFb8+ai8ss=</DigestValue></Reference></SignedInfo><SignatureValue>IDeU7DwlyrEORnFANQXDU9BSzSqxdUghEJlNqR97r026Ia06GJcmTEXLJrOZPrImgzMHmRYbc3pnd1F/6C02D1GphfR/JkDcC/k+3K6OMiXyv+o2R5bOourI8ysEUap+KLwBYAOhwRW9ZRix1KnfPD2yBO+Pd11oMA/JyuuDNoI=</SignatureValue></Signature></Class>
|
61
CS2JLibrary/NetFramework/System/Net/Sockets/SocketFlags.xml
Normal file
61
CS2JLibrary/NetFramework/System/Net/Sockets/SocketFlags.xml
Normal file
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
This file is
|
||||
|
||||
Copyright 2007,2008,2009,2010 Rustici Software, LLC
|
||||
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
|
||||
-->
|
||||
<Enum xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:www.twigletsoftware.com:schemas:txtemplate:1:0">
|
||||
<Imports>
|
||||
<Import>CS2JNet.System.Net.Sockets.SocketFlags</Import>
|
||||
</Imports>
|
||||
<Java>SocketFlags</Java>
|
||||
<Name>System.Net.Sockets.SocketFlags</Name>
|
||||
<Inherits>
|
||||
<Type>System.Enum</Type>
|
||||
</Inherits>
|
||||
<Members>
|
||||
<Member>
|
||||
<Java>${this:16}.None</Java>
|
||||
<Name>None</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.OutOfBand</Java>
|
||||
<Name>OutOfBand</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Peek</Java>
|
||||
<Name>Peek</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.DontRoute</Java>
|
||||
<Name>DontRoute</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.MaxIOVectorLength</Java>
|
||||
<Name>MaxIOVectorLength</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Truncated</Java>
|
||||
<Name>Truncated</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.ControlDataTruncated</Java>
|
||||
<Name>ControlDataTruncated</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Broadcast</Java>
|
||||
<Name>Broadcast</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Multicast</Java>
|
||||
<Name>Multicast</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Partial</Java>
|
||||
<Name>Partial</Name>
|
||||
</Member>
|
||||
</Members>
|
||||
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue>efTWa4oLEWHXEL6YOzaqcIomFVo=</DigestValue></Reference></SignedInfo><SignatureValue>gg/i649hSZt7bAPM9ZB0QueDX8++7p7/Yzteb7h4p2YkRI22vMM2Lc+jI4lgxIB/Hf5Jd3XI0rGDRcDip2t4bV0ErQbPGTajuJncLj7RJ/BDpCA3nUBWZDYRmypxK/u3r1kf5aCAWQDZm0Bj6XlVK6+++Y+OG2PAkIpbngWlQQc=</SignatureValue></Signature></Enum>
|
45
CS2JLibrary/NetFramework/System/Net/Sockets/SocketType.xml
Normal file
45
CS2JLibrary/NetFramework/System/Net/Sockets/SocketType.xml
Normal file
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
This file is
|
||||
|
||||
Copyright 2007,2008,2009,2010 Rustici Software, LLC
|
||||
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
|
||||
-->
|
||||
<Enum xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:www.twigletsoftware.com:schemas:txtemplate:1:0">
|
||||
<Imports>
|
||||
<Import>CS2JNet.System.Net.Sockets.SocketType</Import>
|
||||
</Imports>
|
||||
<Java>SocketType</Java>
|
||||
<Name>System.Net.Sockets.SocketType</Name>
|
||||
<Inherits>
|
||||
<Type>System.Enum</Type>
|
||||
</Inherits>
|
||||
<Members>
|
||||
<Member>
|
||||
<Java>${this:16}.Stream</Java>
|
||||
<Name>Stream</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Dgram</Java>
|
||||
<Name>Dgram</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Raw</Java>
|
||||
<Name>Raw</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Rdm</Java>
|
||||
<Name>Rdm</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Seqpacket</Java>
|
||||
<Name>Seqpacket</Name>
|
||||
</Member>
|
||||
<Member>
|
||||
<Java>${this:16}.Unknown</Java>
|
||||
<Name>Unknown</Name>
|
||||
</Member>
|
||||
</Members>
|
||||
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue>efTWa4oLEWHXEL6YOzaqcIomFVo=</DigestValue></Reference></SignedInfo><SignatureValue>gg/i649hSZt7bAPM9ZB0QueDX8++7p7/Yzteb7h4p2YkRI22vMM2Lc+jI4lgxIB/Hf5Jd3XI0rGDRcDip2t4bV0ErQbPGTajuJncLj7RJ/BDpCA3nUBWZDYRmypxK/u3r1kf5aCAWQDZm0Bj6XlVK6+++Y+OG2PAkIpbngWlQQc=</SignatureValue></Signature></Enum>
|
39
CS2JLibrary/src/CS2JNet/System/Net/EndPoint.java
Normal file
39
CS2JLibrary/src/CS2JNet/System/Net/EndPoint.java
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Author(s):
|
||||
|
||||
Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
*/
|
||||
|
||||
package CS2JNet.System.Net;
|
||||
|
||||
import CS2JNet.System.Net.Sockets.AddressFamily;
|
||||
|
||||
/**
|
||||
* @author keving
|
||||
*
|
||||
*/
|
||||
public abstract class EndPoint {
|
||||
|
||||
/**
|
||||
* @return the addressFamily
|
||||
*/
|
||||
public abstract AddressFamily getAddressFamily();
|
||||
|
||||
protected EndPoint() {
|
||||
}
|
||||
|
||||
}
|
80
CS2JLibrary/src/CS2JNet/System/Net/IPAddress.java
Normal file
80
CS2JLibrary/src/CS2JNet/System/Net/IPAddress.java
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Author(s):
|
||||
|
||||
Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
*/
|
||||
|
||||
package CS2JNet.System.Net;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* @author keving
|
||||
*
|
||||
*/
|
||||
public class IPAddress {
|
||||
|
||||
private byte[] address;
|
||||
private boolean isAny = false;
|
||||
|
||||
/**
|
||||
* @return the address
|
||||
*/
|
||||
public byte[] getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param address the address to set
|
||||
*/
|
||||
public void setAddress(byte[] address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return If true, provides an IP address that indicates that the server must listen for client activity on all network interfaces
|
||||
*/
|
||||
public boolean isAny() {
|
||||
return this.isAny;
|
||||
}
|
||||
|
||||
public IPAddress(byte[] inAddress, boolean any) {
|
||||
setAddress(inAddress);
|
||||
this.isAny = any;
|
||||
}
|
||||
|
||||
public IPAddress(byte[] inAddress) {
|
||||
this(inAddress, false);
|
||||
}
|
||||
|
||||
public static final IPAddress Any = new IPAddress(null, true);
|
||||
|
||||
public String toString()
|
||||
{
|
||||
String ret = "";
|
||||
try {
|
||||
ret = InetAddress.getByAddress(address).toString();
|
||||
} catch (UnknownHostException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
89
CS2JLibrary/src/CS2JNet/System/Net/IPEndPoint.java
Normal file
89
CS2JLibrary/src/CS2JNet/System/Net/IPEndPoint.java
Normal file
@ -0,0 +1,89 @@
|
||||
/*
|
||||
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Author(s):
|
||||
|
||||
Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
*/
|
||||
|
||||
package CS2JNet.System.Net;
|
||||
|
||||
import java.net.InetAddress;
|
||||
|
||||
import CS2JNet.System.Net.Sockets.AddressFamily;
|
||||
|
||||
/**
|
||||
* @author keving
|
||||
*
|
||||
*/
|
||||
public class IPEndPoint extends EndPoint {
|
||||
|
||||
public static final int MaxPort = 0x0000FFFF;
|
||||
public static final int MinPort = 0x00000000;
|
||||
|
||||
private IPAddress ipAddress;
|
||||
private AddressFamily addressFamily;
|
||||
private int port = 0;
|
||||
/**
|
||||
* @return the address
|
||||
*/
|
||||
public IPAddress getIPAddress() {
|
||||
return ipAddress;
|
||||
}
|
||||
/**
|
||||
* @param address the address to set
|
||||
*/
|
||||
public void setIPAddress(IPAddress address) {
|
||||
this.ipAddress = address;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddressFamily getAddressFamily() {
|
||||
return addressFamily;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the port
|
||||
*/
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
/**
|
||||
* @param port the port to set
|
||||
*/
|
||||
public void setPort(int port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public IPEndPoint(byte[] address, int port) {
|
||||
setIPAddress(new IPAddress(address));
|
||||
setPort(port);
|
||||
}
|
||||
|
||||
public IPEndPoint(IPAddress address, int port) {
|
||||
setIPAddress(address);
|
||||
setPort(port);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return If true, provides an IP address that indicates that the server must listen for client activity on all network interfaces
|
||||
*/
|
||||
public boolean isAny() {
|
||||
return ipAddress != null && ipAddress.isAny();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
/*
|
||||
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Author(s):
|
||||
|
||||
Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
*/
|
||||
|
||||
package CS2JNet.System.Net.Sockets;
|
||||
|
||||
/**
|
||||
* @author keving
|
||||
*
|
||||
*/
|
||||
public enum AddressFamily {
|
||||
|
||||
Unknown, // Unknown address family.
|
||||
Unspecified, // Unspecified address family.
|
||||
Unix, // Unix local to host address.
|
||||
InterNetwork, // Address for IP version 4.
|
||||
ImpLink, // ARPANET IMP address.
|
||||
Pup, // Address for PUP protocols.
|
||||
Chaos, // Address for MIT CHAOS protocols.
|
||||
NS, // Address for Xerox NS protocols.
|
||||
Ipx, // IPX or SPX address.
|
||||
Iso, // Address for ISO protocols.
|
||||
Osi, // Address for OSI protocols.
|
||||
Ecma, // European Computer Manufacturers Association (ECMA) address.
|
||||
DataKit, // Address for Datakit protocols.
|
||||
Ccitt, // Addresses for CCITT protocols, such as X.25.
|
||||
Sna, // IBM SNA address.
|
||||
DecNet, // DECnet address.
|
||||
DataLink, // Direct data-link interface address.
|
||||
Lat, // LAT address.
|
||||
HyperChannel, // NSC Hyperchannel address.
|
||||
AppleTalk, // AppleTalk address.
|
||||
NetBios, // NetBios address.
|
||||
VoiceView, // VoiceView address.
|
||||
FireFox, // FireFox address.
|
||||
Banyan, // Banyan address.
|
||||
Atm, // Native ATM services address.
|
||||
InterNetworkV6, // Address for IP version 6.
|
||||
Cluster, // Address for Microsoft cluster products.
|
||||
Ieee12844, // IEEE 1284.4 workgroup address.
|
||||
Irda, // IrDA address.
|
||||
NetworkDesigners, // Address for Network Designers OSI gateway-enabled protocols.
|
||||
Max //MAX address.
|
||||
}
|
229
CS2JLibrary/src/CS2JNet/System/Net/Sockets/NetSocket.java
Normal file
229
CS2JLibrary/src/CS2JNet/System/Net/Sockets/NetSocket.java
Normal file
@ -0,0 +1,229 @@
|
||||
/*
|
||||
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Author(s):
|
||||
|
||||
Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
*/
|
||||
|
||||
package CS2JNet.System.Net.Sockets;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.InetAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
|
||||
import CS2JNet.System.InvalidOperationException;
|
||||
import CS2JNet.System.NotImplementedException;
|
||||
|
||||
import CS2JNet.System.Net.EndPoint;
|
||||
import CS2JNet.System.Net.IPEndPoint;
|
||||
|
||||
/**
|
||||
* @author keving
|
||||
*
|
||||
*/
|
||||
public class NetSocket {
|
||||
|
||||
private EndPoint endPoint = null;
|
||||
|
||||
private AddressFamily addressFamily = null;
|
||||
private SocketType socketType = null;
|
||||
private ProtocolType protocolType = null;
|
||||
|
||||
// local booleans so that we can quickly see that correct protocol has been followed
|
||||
private boolean bindCalled = false;
|
||||
private boolean listenCalled = false;
|
||||
|
||||
public NetSocket(AddressFamily inAddressFamily,
|
||||
SocketType inSocketType,
|
||||
ProtocolType inProtocolType) {
|
||||
addressFamily = inAddressFamily;
|
||||
socketType = inSocketType;
|
||||
protocolType = inProtocolType;
|
||||
}
|
||||
|
||||
public NetSocket() {
|
||||
}
|
||||
|
||||
|
||||
private ServerSocket serverSocket = null;
|
||||
|
||||
private Socket clientSocket = null;
|
||||
|
||||
private OutputStream outStream = null;
|
||||
private InputStream inStream = null;
|
||||
/***
|
||||
*
|
||||
* @param ep
|
||||
*/
|
||||
public void bind(EndPoint ep) {
|
||||
bindCalled = true;
|
||||
endPoint = ep;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param backlog
|
||||
* @throws SocketException
|
||||
* @throws IOException
|
||||
*/
|
||||
public void listen(int backlog) throws SocketException, IOException {
|
||||
if (!bindCalled) {
|
||||
throw new SocketException();
|
||||
}
|
||||
listenCalled = true;
|
||||
if (endPoint != null && endPoint instanceof IPEndPoint) {
|
||||
IPEndPoint ipEndPoint = (IPEndPoint) endPoint;
|
||||
if (ipEndPoint.isAny()) {
|
||||
serverSocket = new ServerSocket(ipEndPoint.getPort(), backlog);
|
||||
}
|
||||
else {
|
||||
serverSocket = new ServerSocket(ipEndPoint.getPort(), backlog, InetAddress.getByAddress(ipEndPoint.getIPAddress().getAddress()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @return
|
||||
* @throws InvalidOperationException
|
||||
* @throws IOException
|
||||
*/
|
||||
public NetSocket accept() throws InvalidOperationException, IOException {
|
||||
if (!bindCalled || !listenCalled || serverSocket == null)
|
||||
throw new InvalidOperationException();
|
||||
|
||||
Socket client = serverSocket.accept();
|
||||
NetSocket ret = new NetSocket();
|
||||
ret.clientSocket = client;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public EndPoint getRemoteEndPoint() {
|
||||
EndPoint ret = null;
|
||||
if (clientSocket != null) {
|
||||
ret = new IPEndPoint(clientSocket.getInetAddress().getAddress(), clientSocket.getPort());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param data
|
||||
* @param length
|
||||
* @param none
|
||||
* @return number pf bytes sent
|
||||
* @throws IOException
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public int receive(byte[] data, int size, SocketFlags socketFlags) throws IOException, NotImplementedException {
|
||||
if (socketFlags != SocketFlags.None) {
|
||||
throw new NotImplementedException("CS2J: socket receive does not yet support flags other than SocketFlags.None");
|
||||
}
|
||||
if (inStream == null) {
|
||||
inStream = clientSocket.getInputStream();
|
||||
}
|
||||
int ret = inStream.read(data, 0, size);
|
||||
return (ret == -1 ? 0 : ret);
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param data
|
||||
* @param socketFlags
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public int receive(byte[] data, SocketFlags socketFlags) throws IOException, NotImplementedException {
|
||||
return receive(data, data.length, socketFlags);
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public int receive(byte[] data) throws IOException, NotImplementedException {
|
||||
return receive(data, data.length, SocketFlags.None);
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param data
|
||||
* @param length
|
||||
* @param none
|
||||
* @return number pf bytes sent
|
||||
* @throws IOException
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public int send(byte[] data, int size, SocketFlags socketFlags) throws IOException, NotImplementedException {
|
||||
if (socketFlags != SocketFlags.None) {
|
||||
throw new NotImplementedException("CS2J: socket send does not yet support flags other than SocketFlags.None");
|
||||
}
|
||||
int ret = size;
|
||||
if (outStream == null) {
|
||||
outStream = clientSocket.getOutputStream();
|
||||
}
|
||||
outStream.write(data, 0, size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param data
|
||||
* @param socketFlags
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public int send(byte[] data, SocketFlags socketFlags) throws IOException, NotImplementedException {
|
||||
return send(data, data.length, socketFlags);
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public int send(byte[] data) throws IOException, NotImplementedException {
|
||||
return send(data, data.length, SocketFlags.None);
|
||||
}
|
||||
|
||||
/***
|
||||
* Closes any open sockets
|
||||
* @throws IOException
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
if (inStream != null)
|
||||
inStream.close();
|
||||
if (outStream != null)
|
||||
outStream.close();
|
||||
if (clientSocket != null)
|
||||
clientSocket.close();
|
||||
if (serverSocket != null)
|
||||
serverSocket.close();
|
||||
}
|
||||
|
||||
}
|
54
CS2JLibrary/src/CS2JNet/System/Net/Sockets/ProtocolType.java
Normal file
54
CS2JLibrary/src/CS2JNet/System/Net/Sockets/ProtocolType.java
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Author(s):
|
||||
|
||||
Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
*/
|
||||
|
||||
package CS2JNet.System.Net.Sockets;
|
||||
|
||||
/**
|
||||
* @author keving
|
||||
*
|
||||
*/
|
||||
public enum ProtocolType {
|
||||
|
||||
IP, // Internet Protocol.
|
||||
IPv6HopByHopOptions, // IPv6 Hop by Hop Options header.
|
||||
Icmp, // Internet Control Message Protocol.
|
||||
Igmp, // Internet Group Management Protocol.
|
||||
Ggp, // Gateway To Gateway Protocol.
|
||||
IPv4, // Internet Protocol version 4.
|
||||
Tcp, // Transmission Control Protocol.
|
||||
Pup, // PARC Universal Packet Protocol.
|
||||
Udp, // User Datagram Protocol.
|
||||
Idp, // Internet Datagram Protocol.
|
||||
IPv6, // Internet Protocol version 6 (IPv6).
|
||||
IPv6RoutingHeader, // IPv6 Routing header.
|
||||
IPv6FragmentHeader, // IPv6 Fragment header.
|
||||
IPSecEncapsulatingSecurityPayload, // IPv6 Encapsulating Security Payload header.
|
||||
IPSecAuthenticationHeader, // IPv6 Authentication header. For details, see RFC 2292 section 2.2.1, available at http://www.ietf.org.
|
||||
IcmpV6, // Internet Control Message Protocol for IPv6.
|
||||
IPv6NoNextHeader, // IPv6 No next header.
|
||||
IPv6DestinationOptions, // IPv6 Destination Options header.
|
||||
ND, // Net Disk Protocol (unofficial).
|
||||
Raw, // Raw IP packet protocol.
|
||||
Unspecified, // Unspecified protocol.
|
||||
Ipx, // Internet Packet Exchange Protocol.
|
||||
Spx, // Sequenced Packet Exchange protocol.
|
||||
SpxII, // Sequenced Packet Exchange version 2 protocol.
|
||||
Unknown // Unknown protocol.
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Author(s):
|
||||
|
||||
Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
*/
|
||||
|
||||
package CS2JNet.System.Net.Sockets;
|
||||
|
||||
public class SocketException extends Exception {
|
||||
|
||||
private int errorCode = 0;
|
||||
|
||||
|
||||
/**
|
||||
* @return the errorCode
|
||||
*/
|
||||
public int getErrorCode() {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
public SocketException() {
|
||||
}
|
||||
|
||||
public SocketException(int code) {
|
||||
errorCode = code;
|
||||
}
|
||||
}
|
39
CS2JLibrary/src/CS2JNet/System/Net/Sockets/SocketFlags.java
Normal file
39
CS2JLibrary/src/CS2JNet/System/Net/Sockets/SocketFlags.java
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Author(s):
|
||||
|
||||
Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
*/
|
||||
|
||||
package CS2JNet.System.Net.Sockets;
|
||||
|
||||
/**
|
||||
* @author keving
|
||||
*
|
||||
*/
|
||||
public enum SocketFlags {
|
||||
|
||||
None, // Use no flags for this call.
|
||||
OutOfBand, // Process out-of-band data.
|
||||
Peek, // Peek at the incoming message.
|
||||
DontRoute, // Send without using routing tables.
|
||||
MaxIOVectorLength, // Provides a standard value for the number of WSABUF structures that are used to send and receive data.
|
||||
Truncated, // The message was too large to fit into the specified buffer and was truncated.
|
||||
ControlDataTruncated, // Indicates that the control data did not fit into an internal 64-KB buffer and was truncated.
|
||||
Broadcast, // Indicates a broadcast packet.
|
||||
Multicast, // Indicates a multicast packet.
|
||||
Partial // Partial send or receive for message.
|
||||
}
|
34
CS2JLibrary/src/CS2JNet/System/Net/Sockets/SocketType.java
Normal file
34
CS2JLibrary/src/CS2JNet/System/Net/Sockets/SocketType.java
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Author(s):
|
||||
|
||||
Kevin Glynn (kevin.glynn@twigletsoftware.com)
|
||||
*/
|
||||
|
||||
package CS2JNet.System.Net.Sockets;
|
||||
|
||||
/**
|
||||
* @author keving
|
||||
*
|
||||
*/
|
||||
public enum SocketType {
|
||||
Stream, // Supports reliable, two-way, connection-based byte streams without the duplication of data and without preservation of boundaries. A Socket of this type communicates with a single peer and requires a remote host connection before communication can begin. Stream uses the Transmission Control Protocol (Tcp) ProtocolType and the InterNetwork AddressFamily.
|
||||
Dgram, // Supports datagrams, which are connectionless, unreliable messages of a fixed (typically small) maximum length. Messages might be lost or duplicated and might arrive out of order. A Socket of type Dgram requires no connection prior to sending and receiving data, and can communicate with multiple peers. Dgram uses the Datagram Protocol (Udp) and the InterNetwork AddressFamily.
|
||||
Raw, // Supports access to the underlying transport protocol. Using the SocketType Raw, you can communicate using protocols like Internet Control Message Protocol (Icmp) and Internet Group Management Protocol (Igmp). Your application must provide a complete IP header when sending. Received datagrams return with the IP header and options intact.
|
||||
Rdm, // Supports connectionless, message-oriented, reliably delivered messages, and preserves message boundaries in data. Rdm (Reliably Delivered Messages) messages arrive unduplicated and in order. Furthermore, the sender is notified if messages are lost. If you initialize a Socket using Rdm, you do not require a remote host connection before sending and receiving data. With Rdm, you can communicate with multiple peers.
|
||||
Seqpacket, // Provides connection-oriented and reliable two-way transfer of ordered byte streams across a network. Seqpacket does not duplicate data, and it preserves boundaries within the data stream. A Socket of type Seqpacket communicates with a single peer and requires a remote host connection before communication can begin.
|
||||
Unknown // Specifies an unknown Socket type.
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user