public void Start() { try { // get the server and its port and connect it to an endpoint IPAddress ip = IPAddress.Parse(Settings.ip_address); IPEndPoint remoteEP = new IPEndPoint(ip, Settings.port_number); try { // socket used to send information Socket sender = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); Chat messenger = new Chat(); sender.Connect(remoteEP); // intially we want to send a message to the server telling what IP is connecting to it messenger.SendIP(sender); // Begin Chat. while (true) { messenger.SendMessage(sender); // send the message // get the bytes that we recieve byte[] buf = new byte[1024]; int BytesRecieved = sender.Receive(buf); // write out any response we recieve. string returned = Encoding.ASCII.GetString(buf, 0, BytesRecieved); returned = returned.Replace("<EOF>", ""); } sender.Shutdown(SocketShutdown.Send); } catch (Exception) { } } catch (Exception) { throw; } }
private void NotifyXmppMessage(string publishKey, object sender, MessageReceivedEventArgs args) { if (args.MessageId != null && args.MessageId.StartsWith("hm_", StringComparison.OrdinalIgnoreCase) || args.Sender.ConferenceUser && string.IsNullOrEmpty(args.Sender.Name)) return; UberChatClient client = sender as UberChatClient; ContactsNotificationService.JsContact jsContact = ContactsNotificationService.JsContact.Create(client, args.Sender); jsContact.Accounts = new List<int>((IEnumerable<int>) new int[1] { client.AccountHandle }); var fAnonymousType11 = new { Sender = jsContact, Subject = args.Subject, Message = args.Message, Timestamp = args.Timestamp, RealmId = client.RealmId, Handle = client.AccountHandle }; JsApiService.Push(publishKey, (object) fAnonymousType11); }
static void Main(string[] args) { var MyChat = new Chat(); }
private void NotifyXmppMessage(string publishKey, object sender, MessageReceivedEventArgs args) { if (args.MessageId != null && args.MessageId.StartsWith("hm_", StringComparison.OrdinalIgnoreCase)) { return; } if (args.Sender.ConferenceUser && string.IsNullOrEmpty(args.Sender.Name)) { return; } UberChatClient uberChatClient = sender as UberChatClient; ContactsNotificationService.JsContact nums = ContactsNotificationService.JsContact.Create(uberChatClient, args.Sender); int[] accountHandle = new int[] { uberChatClient.AccountHandle }; nums.Accounts = new List<int>(accountHandle); var variable = new { Sender = nums, Subject = args.Subject, Message = args.Message, Timestamp = args.Timestamp, RealmId = uberChatClient.RealmId, Handle = uberChatClient.AccountHandle }; JsApiService.Push(publishKey, variable); }
static void Main(string[] args) { Chat.Start(); // startar chatten }
public RoomAccess(Chat.RoomPrx RoomProxy, string SessionId) { this.RoomProxy_prop = RoomProxy; this.SessionId_prop = SessionId; }