Click here to Skip to main content
15,920,053 members
Home / Discussions / C#
   

C#

 
GeneralRe: HTML Table tag text Scraping Pin
Luc Pattyn19-Jul-10 4:29
sitebuilderLuc Pattyn19-Jul-10 4:29 
AnswerRe: HTML Table tag text Scraping Pin
PIEBALDconsult19-Jul-10 4:21
mvePIEBALDconsult19-Jul-10 4:21 
QuestionReading user/group of your local machine Pin
dabuskol19-Jul-10 0:39
dabuskol19-Jul-10 0:39 
QuestionHi Pin
KORCARI18-Jul-10 23:27
KORCARI18-Jul-10 23:27 
AnswerRe: Hi Pin
Mycroft Holmes19-Jul-10 2:57
professionalMycroft Holmes19-Jul-10 2:57 
GeneralRe: Hi Pin
KORCARI19-Jul-10 3:19
KORCARI19-Jul-10 3:19 
QuestionSending XML over a Socket connection Pin
Priya Prk18-Jul-10 22:53
Priya Prk18-Jul-10 22:53 
AnswerRe: Sending XML over a Socket connection Pin
Peace ON18-Jul-10 23:08
Peace ON18-Jul-10 23:08 
Find below code for the same.

XDocument doc = XDocument.Parse("<Hello>World</Hello>", LoadOptions.PreserveWhitespace);
		string host = "localhost";
		int port = 1234;
		
		// Look up the address for the specified host.
		IPHostEntry address = Dns.GetHostEntry(host);
		IPEndPoint ipe = new IPEndPoint(address.AddressList[0], port);

		// Create Socket.	
		using (Socket sock = new Socket(ipe.AddressFamily, SocketType.Stream, ProtocolType.Tcp))
		{
			sock.Connect(ipe); // Connect to the Socket.
			// Create Stream.
			using (NetworkStream sockStream = new NetworkStream(sock))
			{
				// Read from the XDocument.
				using (XmlReader reader = doc.CreateReader())
				{
					// Copy nodes to an XmlWriter which transforms them to bytes that are written to the Stream for the Socket.
					XmlWriterSettings settings = new XmlWriterSettings();
					settings.Encoding = new UTF8Encoding(false, true);
					using (XmlWriter writer = XmlWriter.Create(sockStream, settings))
					{
						while (reader.Read()) // While there is another XML node...
						{
							writer.WriteNode(reader, false); // Copy that node.
						}
					}
				}
			}
		}



For more information find following links useful.
File Transfer using Socket Application in C# .NET 2.0[^]
http://social.msdn.microsoft.com/Forums/en/ncl/thread/6994d38b-5caf-47ff-a425-969651d1a292[^]



HTH
Jinal Desai - LIVE
Experience is mother of sage....

QuestionRead both attributes and subtree of an XML element using XmlTextReader Pin
PPKeno18-Jul-10 22:05
PPKeno18-Jul-10 22:05 
AnswerRe: Read both attributes and subtree of an XML element using XmlTextReader Pin
Peace ON18-Jul-10 22:34
Peace ON18-Jul-10 22:34 
QuestionReading .dbc file in C# Pin
Niungareamit18-Jul-10 20:14
Niungareamit18-Jul-10 20:14 
AnswerRe: Reading .dbc file in C# Pin
V.18-Jul-10 20:32
professionalV.18-Jul-10 20:32 
AnswerRe: Reading .dbc file in C# Pin
Richard MacCutchan18-Jul-10 22:33
mveRichard MacCutchan18-Jul-10 22:33 
QuestionReading Microsoft Project file problem Pin
DJ24518-Jul-10 17:42
DJ24518-Jul-10 17:42 
AnswerRe: Reading Microsoft Project file problem Pin
Peace ON18-Jul-10 22:49
Peace ON18-Jul-10 22:49 
QuestionC# version of C++ code Pin
gordon305618-Jul-10 16:06
gordon305618-Jul-10 16:06 
AnswerRe: C# version of C++ code [modified] Pin
JF201518-Jul-10 18:08
JF201518-Jul-10 18:08 
AnswerRe: C# version of C++ code Pin
Dave Doknjas19-Jul-10 10:52
Dave Doknjas19-Jul-10 10:52 
QuestionHow to draw and smooth Polyline. Pin
tranvantinhpt18-Jul-10 16:05
tranvantinhpt18-Jul-10 16:05 
AnswerRe: How to draw and smooth Polyline. Pin
Abhinav S18-Jul-10 18:24
Abhinav S18-Jul-10 18:24 
GeneralRe: How to draw and smooth Polyline. Pin
tranvantinhpt18-Jul-10 18:42
tranvantinhpt18-Jul-10 18:42 
QuestionCopying table Pin
humayunlalzad18-Jul-10 13:51
humayunlalzad18-Jul-10 13:51 
AnswerRe: Copying table Pin
Mycroft Holmes18-Jul-10 14:29
professionalMycroft Holmes18-Jul-10 14:29 
GeneralRe: Copying table Pin
harold aptroot18-Jul-10 14:38
harold aptroot18-Jul-10 14:38 
GeneralRe: Copying table Pin
humayunlalzad18-Jul-10 17:53
humayunlalzad18-Jul-10 17:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.