Connection changes.
This commit is contained in:
parent
e93c7fee4c
commit
26716c6648
25
net/Conn.cs
25
net/Conn.cs
@ -18,14 +18,35 @@ namespace lib
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public interface ISerDes<T> where T : IFormatter
|
||||||
|
{
|
||||||
|
|
||||||
|
T getInstance();
|
||||||
|
|
||||||
|
|
||||||
public class Conn
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class NewEveryCall<T> : ISerDes<T> where T : IFormatter, new()
|
||||||
|
{
|
||||||
|
public T getInstance()
|
||||||
|
{
|
||||||
|
return new T();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class Conn<T, TInst> where T : IFormatter, new()
|
||||||
|
where TInst : ISerDes<T>, new()
|
||||||
{
|
{
|
||||||
public Socket Sock { get { return m_socket; } }
|
public Socket Sock { get { return m_socket; } }
|
||||||
public Stream Stream { get { return m_streamNet; } }
|
public Stream Stream { get { return m_streamNet; } }
|
||||||
|
|
||||||
|
|
||||||
|
private TInst m_formatter = new TInst();
|
||||||
|
|
||||||
|
|
||||||
public Conn( Socket sock, IProcess proc )
|
public Conn( Socket sock, IProcess proc )
|
||||||
{
|
{
|
||||||
m_socket = sock;
|
m_socket = sock;
|
||||||
@ -46,7 +67,7 @@ namespace lib
|
|||||||
{
|
{
|
||||||
object obj = null;
|
object obj = null;
|
||||||
|
|
||||||
var formatter = new XmlFormatter2();
|
var formatter = m_formatter.getInstance();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user