diff options
author | fcolin | 2007-02-01 12:05:47 +0000 |
---|---|---|
committer | fcolin | 2007-02-01 12:05:47 +0000 |
commit | 3593a483d5566779f1d56e037615685cdc77c0a0 (patch) | |
tree | 300986bb2f463148fd0773efc5f69654ae2cd53f /IvyToDel/IvyPPC/IvyUDPStream.cs | |
parent | 3ce9b3f180e3f52c7be79e0a23bbd1a0b5120ac6 (diff) | |
download | ivy-csharp-3593a483d5566779f1d56e037615685cdc77c0a0.zip ivy-csharp-3593a483d5566779f1d56e037615685cdc77c0a0.tar.gz ivy-csharp-3593a483d5566779f1d56e037615685cdc77c0a0.tar.bz2 ivy-csharp-3593a483d5566779f1d56e037615685cdc77c0a0.tar.xz |
modification structure svn
Diffstat (limited to 'IvyToDel/IvyPPC/IvyUDPStream.cs')
-rw-r--r-- | IvyToDel/IvyPPC/IvyUDPStream.cs | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/IvyToDel/IvyPPC/IvyUDPStream.cs b/IvyToDel/IvyPPC/IvyUDPStream.cs deleted file mode 100644 index 0e3f517..0000000 --- a/IvyToDel/IvyPPC/IvyUDPStream.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Net;
-using System.Net.Sockets;
-using System.IO;
-
-namespace IvyBus
-{
- abstract class IvyUDPStream
- {
- Socket socket;
- byte[] buffer;
-
- protected MemoryStream out_stream;
- protected MemoryStream in_stream;
-
- ushort protocol_version;
-
- public ushort ProtocolVersion
- {
- get { return protocol_version; }
- }
-
- public IvyUDPStream(Socket _socket, ushort protocol)
- {
- socket = _socket;
- buffer = new byte[4096];
- in_stream = new MemoryStream(buffer);
- out_stream = new MemoryStream();
- protocol_version = protocol;
- }
- internal void Close()
- {
- in_stream.Close();
- out_stream.Close();
- socket.Shutdown(SocketShutdown.Both);
- socket.Close();
- }
- internal void receiveMsg(out IPEndPoint remote, out ushort version, out ushort port, out string appId, out string appName)
- {
- int len;
- IPEndPoint remoteEP = new IPEndPoint(IPAddress.Any, 0);
- EndPoint tempRemoteEP = (EndPoint)remoteEP;
- remoteEP = null;
- len = socket.ReceiveFrom(buffer, ref tempRemoteEP);
- remote = (IPEndPoint)tempRemoteEP;
- in_stream.Position = 0;
- in_stream.SetLength(len);
- in_stream.Seek(0, SeekOrigin.Begin);
- //Call Deserialization
- Deserialize( out version, out port, out appId, out appName );
- }
- internal void sendMsg(IPEndPoint EPhost, ushort port, string appId, string appName)
- {
- // Call Serialisation
- Serialize(port, appId, appName);
-
- byte[] hellob = out_stream.GetBuffer();
- socket.SendTo(hellob, (int)out_stream.Length, 0, EPhost);
- }
- abstract internal void Serialize(ushort port, string appId, string appName);
- abstract internal void Deserialize(out ushort version, out ushort port, out string appId, out string appName);
-
- }
-}
|