Click here to Skip to main content
16,007,443 members
Home / Discussions / C#
   

C#

 
GeneralRe: video indexer Pin
sana1715-Aug-08 8:41
sana1715-Aug-08 8:41 
AnswerRe: video indexer Pin
Ashfield15-Aug-08 1:18
Ashfield15-Aug-08 1:18 
AnswerRe: video indexer Pin
#realJSOP15-Aug-08 1:22
professional#realJSOP15-Aug-08 1:22 
AnswerRe: video indexer Pin
blackjack215015-Aug-08 1:41
blackjack215015-Aug-08 1:41 
AnswerRe: video indexer Pin
Manas Bhardwaj15-Aug-08 2:03
professionalManas Bhardwaj15-Aug-08 2:03 
QuestionAdd event to DataGridViewTextBoxColumn Pin
kaasir_214-Aug-08 22:32
kaasir_214-Aug-08 22:32 
AnswerRe: Add event to DataGridViewTextBoxColumn Pin
teejayem15-Aug-08 2:21
teejayem15-Aug-08 2:21 
Questionnetflow collector. Pin
Stephen Lintott14-Aug-08 22:31
Stephen Lintott14-Aug-08 22:31 
Hi I am writing a netflow collector in C# and for some or other reason the TcpListener object does not go into a pending state as the netflow packets arrive. Does anybody know of a workaround for this. The code follows


<pre>
using System.IO;
using System.Net;
using System;
using System.Threading;
using N = System.Net;
using System.Collections;

class TalkServ
{

System.Net.Sockets.TcpListener server;
protected String file = "";
protected int port = 4055;
public static void Main(String [] args)
{
TalkServ TS = null;
try
{
TS = new TalkServ(args[0],args[1]);
}
catch (Exception e)
{
Console.WriteLine("\nMust specify a file path as first parameter...\nThe file is used to capture netflow data...");
Console.WriteLine("\nMust specify a port as second parameter...\nThe port is the netflow port...");
}
}

public TalkServ(string f,string p)
{
port = Convert.ToInt32(p);
server = new System.Net.Sockets.TcpListener(port);
file = f;
while (true)
{
server.Start();
if (server.Pending())
{
N.Sockets.TcpClient connection = server.AcceptTcpClient();
Console.WriteLine("Connection made");
BackForth BF = new BackForth(connection,file);
}
}
}



}//end of class TalkServ

class BackForth
{
N.Sockets.TcpClient client;
System.IO.StreamReader SR;
string file;
public BackForth(System.Net.Sockets.TcpClient c,String f)
{
client = c;
file = f;
Thread t = new Thread(new ThreadStart(init));
t.Start();
}
private void run()
{
try
{
string l = "";
while (true)
{
l = SR.ReadLine();
if (l != null)
{
if (!l.Equals(""))
{
StreamWriter writer = new StreamWriter(file, true);
writer.WriteLine(l);
writer.Close();
Console.WriteLine(l);
}
}
}
}
catch (Exception e44) { Console.WriteLine(e44); }
}

private void init()
{
SR = new System.IO.StreamReader(client.GetStream());
Thread t = new Thread(new ThreadStart(run));
t.Start();
}
}
&lt;/pre&gt;

Stephen Lintott Bsc IT (RAU)
AnswerRe: netflow collector. Pin
leppie14-Aug-08 23:31
leppie14-Aug-08 23:31 
GeneralRe: netflow collector. Pin
Stephen Lintott14-Aug-08 23:35
Stephen Lintott14-Aug-08 23:35 
GeneralRe: netflow collector. Pin
leppie14-Aug-08 23:41
leppie14-Aug-08 23:41 
GeneralRe: netflow collector. Pin
Stephen Lintott14-Aug-08 23:46
Stephen Lintott14-Aug-08 23:46 
GeneralRe: netflow collector. Pin
leppie14-Aug-08 23:50
leppie14-Aug-08 23:50 
GeneralRe: netflow collector. Pin
Stephen Lintott15-Aug-08 1:01
Stephen Lintott15-Aug-08 1:01 
QuestionHow to deep-copy the ListCollectionView? Pin
Michael Sync14-Aug-08 22:30
Michael Sync14-Aug-08 22:30 
AnswerRe: How to deep-copy the ListCollectionView? Pin
leppie14-Aug-08 23:36
leppie14-Aug-08 23:36 
GeneralRe: How to deep-copy the ListCollectionView? Pin
Michael Sync14-Aug-08 23:41
Michael Sync14-Aug-08 23:41 
GeneralRe: How to deep-copy the ListCollectionView? Pin
leppie14-Aug-08 23:43
leppie14-Aug-08 23:43 
GeneralRe: How to deep-copy the ListCollectionView? Pin
Michael Sync14-Aug-08 23:48
Michael Sync14-Aug-08 23:48 
GeneralRe: How to deep-copy the ListCollectionView? Pin
leppie15-Aug-08 0:31
leppie15-Aug-08 0:31 
GeneralRe: How to deep-copy the ListCollectionView? Pin
Michael Sync15-Aug-08 18:44
Michael Sync15-Aug-08 18:44 
GeneralRe: How to deep-copy the ListCollectionView? Pin
N a v a n e e t h15-Aug-08 6:06
N a v a n e e t h15-Aug-08 6:06 
AnswerRe: How to deep-copy the ListCollectionView? Pin
Alaric_15-Aug-08 5:28
professionalAlaric_15-Aug-08 5:28 
GeneralRe: How to deep-copy the ListCollectionView? Pin
Michael Sync15-Aug-08 15:52
Michael Sync15-Aug-08 15:52 
QuestionEscaping Quotes Pin
maliary14-Aug-08 21:52
maliary14-Aug-08 21:52 

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.