NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Net;

using System.Net.Sockets;

using System.Xml;

using System.Xml.Serialization;

using System.IO;





namespace ClientAgSerialized

{

class NetworkStreamTcpClient

{

public static void Main()

{

Produs produs1 = new Produs(1, "Laptop", 4000);

Produs produs2 = new Produs(2, "Desktop", 3500);



string data, data1, input1;

string input = produs1.arata_produs() + " " + produs2.arata_produs();

Console.WriteLine("Testare suprascriere ToString:");

Console.WriteLine(produs1.ToString());





// definim endpoint

IPEndPoint ipep = new IPEndPoint(

IPAddress.Parse("172.23.1.252"), 9050);

Socket server = new Socket(AddressFamily.InterNetwork,

SocketType.Stream, ProtocolType.Tcp);

try

{

server.Connect(ipep);

}

catch (SocketException e)

{

Console.WriteLine("Unable to connect to server.");

Console.WriteLine(e.ToString());

return;

}



NetworkStream ns = new NetworkStream(server);

StreamReader sr = new StreamReader(ns);

StreamWriter sw = new StreamWriter(ns);

data = sr.ReadLine();

Console.WriteLine(data);



Console.WriteLine("Date de trimis la server: ");

Console.WriteLine(input);



sw.WriteLine(input);

sw.Flush();

data = sr.ReadLine();

Console.WriteLine(data);

// server.Close();



IPEndPoint ipep1 = new IPEndPoint(

IPAddress.Parse("172.23.1.252"), 9051);

Socket server1 = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);



try

{

server1.Connect(ipep1);

}



catch (Exception s1) { Console.WriteLine(s1.Message); }

NetworkStream ns1 = new NetworkStream(server1);

StreamReader sr1 = new StreamReader("Product.XML");

StreamWriter sw1 = new StreamWriter(ns1);

// Console.WriteLine(sr1.ReadToEnd());

data1 = sr1.ReadToEnd();

input1 = sr1.ReadToEnd().ToString();

sr1 = new StreamReader("Product.XML");

input1 = sr1.ReadToEnd();

//sw1.Write(sr1.ReadToEnd());

// Console.Write(input1);

sr1 = new StreamReader("Product.XML");

// Console.WriteLine(sr1.ReadToEnd());

Console.WriteLine(input1);

sw1.Write(input1);

sw1.Flush();



Console.ReadKey();

}



public static void Serializare()

{

Produs produs1 = new Produs(1, "Laptop", 4000);

Produs produs2 = new Produs(2, "Desktop", 3500);



FileStream fs1 = new FileStream("Product.XML", FileMode.OpenOrCreate);



XmlSerializer xml1 =

new XmlSerializer(typeof(Produs));

xml1.Serialize(fs1, produs1);

xml1.Serialize(fs1, produs2);



fs1.Close();

}

}

}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.