Click here to Skip to main content
15,922,894 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
Questionhow to find a version of DLL Pin
Sujit Gupta9-May-08 7:01
Sujit Gupta9-May-08 7:01 
AnswerRe: how to find a version of DLL Pin
CodingYoshi9-May-08 13:59
CodingYoshi9-May-08 13:59 
QuestionRemoting issue Pin
Siddharth Rastogi8-May-08 22:58
Siddharth Rastogi8-May-08 22:58 
AnswerRe: Remoting issue Pin
CodingYoshi9-May-08 12:18
CodingYoshi9-May-08 12:18 
QuestionHow to find argument type (in] [out] using reflection? Pin
fizk8-May-08 22:11
fizk8-May-08 22:11 
QuestionSocket is closed before all buffered data is transmitted Pin
realbobb8-May-08 20:54
realbobb8-May-08 20:54 
AnswerRe: Socket is closed before all buffered data is transmitted Pin
CodingYoshi9-May-08 13:57
CodingYoshi9-May-08 13:57 
GeneralRe: Socket is closed before all buffered data is transmitted Pin
realbobb12-May-08 21:06
realbobb12-May-08 21:06 
Hi CodingYoshi.

Just to make sure I have mentioned it, the program runs on the compact framework V2..

The streamwriter does not solve the problem. I have made this small console app, which does not use the sockets directly. It still closes the connection before all data is send, if I dont add a delay. To add a delay is not good enough for me...

The small program accepts a connection from e.g. iexplorer via standard http port 80. It replies any request... so just type ( http://ip/ ). The program replies with xml: Hello world!

In this exaple no socket communication is made directly...

Im I doing something really wrong? Really hope someone can help me!

Here is the code:
using System;
using System.Collections.Generic;
using System.Text;

using System.Threading;
using System.Net;
using System.Net.Sockets;
using System.IO;

namespace TestNetworkConsoleApp
{
class Program
{
static void Main(string[] args)
{
TcpListener m_TCPServer;

try
{
m_TCPServer = new TcpListener(IPAddress.Any, 80);
m_TCPServer.Start();

TcpClient tcpClient = m_TCPServer.AcceptTcpClient();
tcpClient.LingerState = new LingerOption(true, 100);

if (tcpClient != null)
{
try
{
string content = Hello World!";
string now = DateTime.Now.ToLongDateString();
StringBuilder txbuffer = new StringBuilder();
txbuffer.Append("HTTP/1.1").Append(" 200 OK\r\n");
txbuffer.Append("Server:This Computer\r\n");
txbuffer.Append("Content-Type:text/xml\r\n"); // Mime type is always text/xml
txbuffer.Append("Last-Modified:").Append(now).Append("\r\n");
txbuffer.Append("Accept-Ranges:bytes\r\n");
txbuffer.Append("Connection:close\r\n");
txbuffer.Append("Content-Length:").Append(content.Length).Append("\r\n");
txbuffer.Append("\r\n");
txbuffer.Append(content);
String s = txbuffer.ToString();

try
{
using (NetworkStream stream = tcpClient.GetStream())
{
StreamWriter w = new StreamWriter(stream);
w.Write(s);
w.Flush();
//Thread.Sleep(2000);
}
}
catch
{
}
}
catch
{
}
}
}
catch { }
}
}
}
Question"?xml namespace="" prefix="asp" ?" in .NET 2005 Pin
salon8-May-08 4:39
salon8-May-08 4:39 
QuestionGet the proper path name, proper case I mean. Pin
AndrewVos8-May-08 3:38
AndrewVos8-May-08 3:38 
AnswerRe: Get the proper path name, proper case I mean. Pin
Dave Kreskowiak8-May-08 4:59
mveDave Kreskowiak8-May-08 4:59 
GeneralRe: Get the proper path name, proper case I mean. Pin
AndrewVos8-May-08 5:14
AndrewVos8-May-08 5:14 
AnswerRe: Get the proper path name, proper case I mean. Pin
Dave Kreskowiak8-May-08 5:32
mveDave Kreskowiak8-May-08 5:32 
GeneralRe: Get the proper path name, proper case I mean. Pin
AndrewVos8-May-08 5:39
AndrewVos8-May-08 5:39 
GeneralRe: Get the proper path name, proper case I mean. Pin
AndrewVos8-May-08 6:12
AndrewVos8-May-08 6:12 
Questiongetting input from user Pin
raydona7-May-08 8:11
raydona7-May-08 8:11 
AnswerRe: getting input from user Pin
Dave Kreskowiak7-May-08 8:42
mveDave Kreskowiak7-May-08 8:42 
Questionhow to use SetWindowLong API function calling in Vb.net Pin
brams77-May-08 4:04
brams77-May-08 4:04 
AnswerRe: how to use SetWindowLong API function calling in Vb.net Pin
Dave Kreskowiak7-May-08 7:12
mveDave Kreskowiak7-May-08 7:12 
GeneralRe: how to use SetWindowLong API function calling in Vb.net Pin
brams77-May-08 10:33
brams77-May-08 10:33 
GeneralRe: how to use SetWindowLong API function calling in Vb.net Pin
Dave Kreskowiak7-May-08 10:57
mveDave Kreskowiak7-May-08 10:57 
GeneralRe: how to use SetWindowLong API function calling in Vb.net Pin
brams79-May-08 4:40
brams79-May-08 4:40 
GeneralRe: how to use SetWindowLong API function calling in Vb.net Pin
Dave Kreskowiak9-May-08 5:44
mveDave Kreskowiak9-May-08 5:44 
QuestionLooking for something that replaces the event DataGridView.SelectionChanging Pin
Shimmy Weitzhandler6-May-08 12:21
Shimmy Weitzhandler6-May-08 12:21 
AnswerRe: Looking for something that replaces the event DataGridView.SelectionChanging Pin
Shimmy Weitzhandler6-May-08 12:57
Shimmy Weitzhandler6-May-08 12:57 

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.