using System;
using System.Collections.Generic;
using System.Text;
namespace BCG {
public delegate void SendConfirmationDelegate(string messageId, bool confirmed);
///
/// This is the very basic connection that sits right
/// on top of the sockets (used on both server and client)
///
public interface ITCPConnection : IDisposable {
public enum ConnectionSide {
Client,
Server
}
///
/// The delegate is fired signalling if the data send was
/// successful or not
///
///
///
///
void sendWithConfirmation(byte[] data, ref string confId, SendConfirmationDelegate del);
///
/// sends data to the other side. theres no guaranatee that
/// data is delievered.
///
///
void send(byte[] data);
///
/// registers a ITCPMessageHandler, to receive messages
/// from the other side.
///
///
void register(ITCPMessageHandler messageHandler);
///
/// Gets the ip and port of the peer to which this
/// connection is connected.
///
///
///
void getPeerAddress(out string ip, out int port);
///
/// Gets its own ip and port, as seen by the peer. So if this
/// is the client, it will returns its ip and the port, as the
/// server sees it. For server, this is the ip and wellknown
/// port of the server
///
///
///
void getSelfAddress(out string ip, out int port);
///
/// if the connection is disconnected, it disposes itself,
/// hence this is an indicator of whether the connection is
/// alive or dead
///
bool isDisposed { get; }
}
}