--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Topics>
+ <Topic id="a9f1cfac-8d7d-4668-af2f-60b588018519" visible="True" isSelected="true" title="Introduction" />
+ <Topic id="4e89497f-70d3-4fb3-9c92-cfd8981ccfa9" visible="True" title="Quickstart" />
+ <Topic id="852623d7-5d68-47e2-b5db-76498da44f95" visible="True" isExpanded="true" title="Technical Details">
+ <Topic id="0ffa7468-4813-4fd0-ba65-2fa5436bc5ce" visible="True" isExpanded="true" title="Protocols">
+ <Topic id="a3d0767d-2da3-45d2-80d7-b0c05698992f" visible="True" />
+ <Topic id="490c9f89-38c8-4ccf-8af1-683ba7fb0888" visible="True" />
+ </Topic>
+ </Topic>
+</Topics>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Topics>
- <Topic id="a9f1cfac-8d7d-4668-af2f-60b588018519" visible="True" isSelected="true" title="Introduction" />
- <Topic id="4e89497f-70d3-4fb3-9c92-cfd8981ccfa9" visible="True" title="Quickstart" />
- <Topic id="852623d7-5d68-47e2-b5db-76498da44f95" visible="True" isExpanded="true" title="Technical Details">
- <Topic id="0ffa7468-4813-4fd0-ba65-2fa5436bc5ce" visible="True" isExpanded="true" title="Protocols">
- <Topic id="a3d0767d-2da3-45d2-80d7-b0c05698992f" visible="True" />
- <Topic id="490c9f89-38c8-4ccf-8af1-683ba7fb0888" visible="True" />
- </Topic>
- </Topic>
-</Topics>
\ No newline at end of file
+++ /dev/null
-class TcpClientExample
-{
- static void Main(string[] args)
- {
- using (TcpConnection connection = new TcpConnection())
- {
- ManualResetEvent e = new ManualResetEvent(false);
-
- //Whenever we receive data print the number of bytes and how it was sent
- connection.DataReceived += (object sender, DataReceivedEventArgs a) =>
- Console.WriteLine("Received {0} bytes via {1}!", a.Bytes.Length, a.SendOption);
-
- //When the end point disconnects from us then release the main thread and exit
- connection.Disconnected += (object sender, DisconnectedEventArgs a) =>
- e.Set();
-
- //Connect to a server
- connection.Connect(new NetworkEndPoint("127.0.0.1", 4296));
-
- //Wait until the end point disconnects from us
- e.WaitOne();
- }
- }
-}
+++ /dev/null
-class TcpListenerExample
-{
- static void Main(string[] args)
- {
- //Setup listener
- using (TcpConnectionListener listener = new TcpConnectionListener(new NetworkEndPoint(IPAddress.Any, 4296)))
- {
- //Start listening for new connection events
- listener.NewConnection += delegate(object sender, NewConnectionEventArgs a)
- {
- //Send the client some data
- a.Connection.SendBytes(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }, SendOption.Reliable);
-
- //Disconnect from the client
- a.Connection.Close();
- };
-
- listener.Start();
-
- Console.ReadKey();
- }
- }
-}
+++ /dev/null
-class UdpClientExample
-{
- static void Main(string[] args)
- {
- using (UdpConnection connection = new UdpConnection())
- {
- ManualResetEvent e = new ManualResetEvent(false);
-
- //Whenever we receive data print the number of bytes and how it was sent
- connection.DataReceived += (object sender, DataReceivedEventArgs a) =>
- Console.WriteLine("Received {0} bytes via {1}!", a.Bytes.Length, a.SendOption);
-
- //When the end point disconnects from us then release the main thread and exit
- connection.Disconnected += (object sender, DisconnectedEventArgs a) =>
- e.Set();
-
- //Connect to a server
- connection.Connect(new NetworkEndPoint("127.0.0.1", 4296));
-
- //Wait until the end point disconnects from us
- e.WaitOne();
- }
- }
-}
+++ /dev/null
-class UdpListenerExample
-{
- static void Main(string[] args)
- {
- //Setup listener
- using (UdpConnectionListener listener = new UdpConnectionListener(new NetworkEndPoint(IPAddress.Any, 4296)))
- {
- //Start listening for new connection events
- listener.NewConnection += delegate(object sender, NewConnectionEventArgs a)
- {
- //Send the client some data
- a.Connection.SendBytes(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }, SendOption.Reliable);
-
- //Disconnect from the client
- a.Connection.Close();
- };
-
- listener.Start();
-
- Console.ReadKey();
- }
- }
-}
+++ /dev/null
-<?xml version="1.0" encoding="utf-8" ?>
-
-<docs>
- <item name="Event_Thread_Safety_Warning">
- <para>
- As with all Hazel events it is invoked on a thread from the .NET
- <see cref="System.Threading.ThreadPool">ThreadPool</see> and hence any subscribers should ensure their
- handling code is thread safe. Implementing connections are not bound to invoking this event in the sequence
- messages are received, in fact implementers are only required to ensure this method is always and only invoked
- for a user sent message, therefore subscribers should be aware that this event may be called out of order and
- may be called whilst another thread is still handling an invocation of the event.
- </para>
- </item>
- <item name="Recyclable">
- <para>
- This object implements IRecyclable and hence can be recycled in order to reduce the number of objects the
- GC has to deal with. When you are done with the object you can either leave it unreferenced as you usually
- would and the GC will collect it or you can call <see cref="Recycle"/> to inform Hazel that the object
- should be reused. Once recycle has been called the contents can be overwritten at any time and so only
- call it once you are completely finished with the object.
- </para>
- </item>
- <item name="Connection_SendBytes_General">
- <para>
- This method sends a number of bytes in a message to the end point of this client using the given
- <see cref="SendOption"/> to describe how the data should be sent. Sending messages requires that the
- this connection is connected to a remote end point and SendBytes will throw an exception if that is not
- the case. See the <see cref="Connection.State"/> property for information on whether a connection is connected or not.
- </para>
- </item>
-</docs>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Topics>
- <Topic id="79b24ac4-3a49-4f2d-b074-019040fd7541" visible="True" isDefault="true" isSelected="true" title="Welcome to the [TODO: Add project name]">
- <HelpKeywords>
- <HelpKeyword index="K" term="Welcome" />
- </HelpKeywords>
- </Topic>
- <Topic id="c960edda-5507-4e9d-af3d-26a418bdf007" visible="True" isExpanded="true" title="Version History">
- <HelpKeywords>
- <HelpKeyword index="K" term="version, history" />
- </HelpKeywords>
- <Topic id="62867feb-6930-4bbe-863b-7e97d4735c73" visible="True" title="Version 1.0.0.0">
- <HelpKeywords>
- <HelpKeyword index="K" term="version, 1.0.0.0" />
- </HelpKeywords>
- </Topic>
- </Topic>
-</Topics>
\ No newline at end of file
</PropertyGroup>
<ItemGroup>
<Folder Include="Content" />
- <Folder Include="Content\DocInclude" />
<Folder Include="Content\Technical Details" />
<Folder Include="Content\Technical Details\Protocols" />
+ <Folder Include="DocInclude\" />
<Folder Include="icons" />
<Folder Include="media" />
</ItemGroup>
<ItemGroup>
- <None Include="Content\DocInclude\common.xml" />
- <None Include="Content\DocInclude\TcpClientExample.cs" />
- <None Include="Content\DocInclude\TcpListenerExample.cs" />
- <None Include="Content\DocInclude\UdpClientExample.cs" />
- <None Include="Content\DocInclude\UdpListenerExample.cs" />
<None Include="Content\Introduction.aml" />
<None Include="Content\Quickstart.aml" />
<None Include="Content\Technical Details\Protocols\Protocols.aml" />
<None Include="Content\Technical Details\Protocols\UDP-RUDP.aml" />
<None Include="Content\Technical Details\Technical Details.aml" />
<None Include="Content\Welcome.aml" />
+ <None Include="DocInclude\common.xml" />
+ <None Include="DocInclude\TcpClientExample.cs" />
+ <None Include="DocInclude\TcpListenerExample.cs" />
+ <None Include="DocInclude\UdpClientExample.cs" />
+ <None Include="DocInclude\UdpListenerExample.cs" />
</ItemGroup>
<ItemGroup>
- <ContentLayout Include="ContentLayout.content" />
- <ContentLayout Include="Content\Content Layout.content" />
+ <ContentLayout Include="Content Layout.content" />
</ItemGroup>
<ItemGroup>
<Content Include="icons\Help.png" />
--- /dev/null
+class TcpClientExample
+{
+ static void Main(string[] args)
+ {
+ using (TcpConnection connection = new TcpConnection())
+ {
+ ManualResetEvent e = new ManualResetEvent(false);
+
+ //Whenever we receive data print the number of bytes and how it was sent
+ connection.DataReceived += (object sender, DataReceivedEventArgs a) =>
+ Console.WriteLine("Received {0} bytes via {1}!", a.Bytes.Length, a.SendOption);
+
+ //When the end point disconnects from us then release the main thread and exit
+ connection.Disconnected += (object sender, DisconnectedEventArgs a) =>
+ e.Set();
+
+ //Connect to a server
+ connection.Connect(new NetworkEndPoint("127.0.0.1", 4296));
+
+ //Wait until the end point disconnects from us
+ e.WaitOne();
+ }
+ }
+}
--- /dev/null
+class TcpListenerExample
+{
+ static void Main(string[] args)
+ {
+ //Setup listener
+ using (TcpConnectionListener listener = new TcpConnectionListener(new NetworkEndPoint(IPAddress.Any, 4296)))
+ {
+ //Start listening for new connection events
+ listener.NewConnection += delegate(object sender, NewConnectionEventArgs a)
+ {
+ //Send the client some data
+ a.Connection.SendBytes(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }, SendOption.Reliable);
+
+ //Disconnect from the client
+ a.Connection.Close();
+ };
+
+ listener.Start();
+
+ Console.ReadKey();
+ }
+ }
+}
--- /dev/null
+class UdpClientExample
+{
+ static void Main(string[] args)
+ {
+ using (UdpConnection connection = new UdpConnection())
+ {
+ ManualResetEvent e = new ManualResetEvent(false);
+
+ //Whenever we receive data print the number of bytes and how it was sent
+ connection.DataReceived += (object sender, DataReceivedEventArgs a) =>
+ Console.WriteLine("Received {0} bytes via {1}!", a.Bytes.Length, a.SendOption);
+
+ //When the end point disconnects from us then release the main thread and exit
+ connection.Disconnected += (object sender, DisconnectedEventArgs a) =>
+ e.Set();
+
+ //Connect to a server
+ connection.Connect(new NetworkEndPoint("127.0.0.1", 4296));
+
+ //Wait until the end point disconnects from us
+ e.WaitOne();
+ }
+ }
+}
--- /dev/null
+class UdpListenerExample
+{
+ static void Main(string[] args)
+ {
+ //Setup listener
+ using (UdpConnectionListener listener = new UdpConnectionListener(new NetworkEndPoint(IPAddress.Any, 4296)))
+ {
+ //Start listening for new connection events
+ listener.NewConnection += delegate(object sender, NewConnectionEventArgs a)
+ {
+ //Send the client some data
+ a.Connection.SendBytes(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }, SendOption.Reliable);
+
+ //Disconnect from the client
+ a.Connection.Close();
+ };
+
+ listener.Start();
+
+ Console.ReadKey();
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+
+<docs>
+ <item name="Event_Thread_Safety_Warning">
+ <para>
+ As with all Hazel events it is invoked on a thread from the .NET
+ <see cref="System.Threading.ThreadPool">ThreadPool</see> and hence any subscribers should ensure their
+ handling code is thread safe. Implementing connections are not bound to invoking this event in the sequence
+ messages are received, in fact implementers are only required to ensure this method is always and only invoked
+ for a user sent message, therefore subscribers should be aware that this event may be called out of order and
+ may be called whilst another thread is still handling an invocation of the event.
+ </para>
+ </item>
+ <item name="Recyclable">
+ <para>
+ This object implements IRecyclable and hence can be recycled in order to reduce the number of objects the
+ GC has to deal with. When you are done with the object you can either leave it unreferenced as you usually
+ would and the GC will collect it or you can call <see cref="Recycle"/> to inform Hazel that the object
+ should be reused. Once recycle has been called the contents can be overwritten at any time and so only
+ call it once you are completely finished with the object.
+ </para>
+ </item>
+ <item name="Connection_SendBytes_General">
+ <para>
+ This method sends a number of bytes in a message to the end point of this client using the given
+ <see cref="SendOption"/> to describe how the data should be sent. Sending messages requires that the
+ this connection is connected to a remote end point and SendBytes will throw an exception if that is not
+ the case. See the <see cref="Connection.State"/> property for information on whether a connection is connected or not.
+ </para>
+ </item>
+</docs>
\ No newline at end of file
/// <include file="DocInclude/common.xml" path="docs/item[@name='Event_Thread_Safety_Warning']/*" />
/// </remarks>
/// <example>
- /// <code language="C#" source="../DocInclude/TcpClientExample.cs"/>
+ /// <code language="C#" source="DocInclude/TcpClientExample.cs"/>
/// </example>
public event EventHandler<DataReceivedEventArgs> DataReceived;
/// <include file="DocInclude/common.xml" path="docs/item[@name='Event_Thread_Safety_Warning']/*" />
/// </remarks>
/// <example>
- /// <code language="C#" source="../DocInclude/TcpClientExample.cs"/>
+ /// <code language="C#" source="DocInclude/TcpClientExample.cs"/>
/// </example>
public event EventHandler<DisconnectedEventArgs> Disconnected;
/// <include file="DocInclude/common.xml" path="docs/item[@name='Event_Thread_Safety_Warning']/*" />
/// </remarks>
/// <example>
- /// <code language="C#" source="../DocInclude/TcpListenerExample.cs"/>
+ /// <code language="C#" source="DocInclude/TcpListenerExample.cs"/>
/// </example>
public event EventHandler<NewConnectionEventArgs> NewConnection;
/// </para>
/// </remarks>
/// <example>
- /// <code language="C#" source="../DocInclude/TcpListenerExample.cs"/>
+ /// <code language="C#" source="DocInclude/TcpListenerExample.cs"/>
/// </example>
public abstract void Start();
<Compile Include="ConnectionState.cs" />
<Compile Include="DataReceivedEventArgs.cs" />
<Compile Include="DisconnectedEventArgs.cs" />
- <None Include="DocInclude\TcpClientExample.cs" />
- <None Include="DocInclude\UdpClientExample.cs" />
- <None Include="DocInclude\TcpListenerExample.cs" />
- <None Include="DocInclude\UdpListenerExample.cs" />
<Compile Include="HazelException.cs" />
<Compile Include="IPMode.cs" />
<Compile Include="IRecyclable.cs" />
<Compile Include="Udp\UdpConnectionListener.cs" />
<Compile Include="Udp\UdpServerConnection.cs" />
</ItemGroup>
- <ItemGroup>
- <Content Include="DocInclude\common.xml">
- <SubType>Designer</SubType>
- </Content>
- </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.