public RssSource(string url, Country sourceCountry, int trustable, Language languageSource, TypeOfInfo type, Area covertArea) { Url = url; SourceCountry = sourceCountry; Trustable = trustable; LanguageSource = languageSource; Type = type; CovertArea = covertArea; }
public static void StartClient() { try { IPHostEntry ipHostInfo = Dns.GetHostEntry("Client1"); IPAddress ipAddress = ipHostInfo.AddressList[1]; IPEndPoint remoteEP = new IPEndPoint(ipAddress, port); Socket client = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); client.BeginConnect(remoteEP, new AsyncCallback(ConnectCallback), client); connectDone.WaitOne(); if (TypeOfTheInfo == TypeOfInfo.User && !flagUser) { flagUser = true; Send(client, user); TypeOfTheInfo = TypeOfInfo.Default; } else if (TypeOfTheInfo == TypeOfInfo.Favourite && !flagFavourite) { flagFavourite = true; Send(client, favourite); TypeOfTheInfo = TypeOfInfo.Default; } else if (TypeOfTheInfo == TypeOfInfo.Comment && !flagComment) { flagComment = true; Send(client, comment); TypeOfTheInfo = TypeOfInfo.Default; } else { Send(client, TypeOfTheInfo.ToString()); } sendDone.WaitOne(); Receive(client); receiveDone.WaitOne(); client.Shutdown(SocketShutdown.Both); client.Close(); connectDone.Reset(); sendDone.Reset(); receiveDone.Reset(); } catch (Exception ex) { MessageBox.Show(ex.Message); Application application = Application.Current; application.Shutdown(); } }
public static void SetTypeInfo(TypeOfInfo src) { TypeOfTheInfo = src; }