internal bool ApproveConnection(IPEndPoint senderEndpoint, byte[] customData, out string failReason) { if (ConnectionRequest != null) { NetConnectRequestEventArgs ea = new NetConnectRequestEventArgs(); ea.EndPoint = senderEndpoint; ea.CustomData = customData; ea.MayConnect = true; ea.DenialReason = null; // ask application ConnectionRequest(this, ea); failReason = ea.DenialReason; return(ea.MayConnect); } failReason = null; return(true); }
internal bool ApproveConnection(IPEndPoint senderEndpoint, byte[] customData, out string failReason) { if (ConnectionRequest != null) { NetConnectRequestEventArgs ea = new NetConnectRequestEventArgs(); ea.EndPoint = senderEndpoint; ea.CustomData = customData; ea.MayConnect = true; ea.DenialReason = null; // ask application ConnectionRequest(this, ea); failReason = ea.DenialReason; return ea.MayConnect; } failReason = null; return true; }
void OnConnectionRequest(object sender, NetConnectRequestEventArgs e) { // At this point we can approve or deny the incoming connection like this: // // e.MayConnect = true; // e.DenialReason = "Sorry, no lamers!"; // // ... possibly depending on the content of e.CustomData which the client // specifies when calling Connect() }