Click here to Skip to main content
15,910,471 members
Home / Discussions / C#
   

C#

 
GeneralRe: OT Pin
leckey25-Apr-08 12:42
leckey25-Apr-08 12:42 
GeneralRe: OT [modified] Pin
Colin Angus Mackay25-Apr-08 15:16
Colin Angus Mackay25-Apr-08 15:16 
GeneralRe: OT Pin
leckey25-Apr-08 16:53
leckey25-Apr-08 16:53 
GeneralRe: help plz Pin
Giorgi Dalakishvili25-Apr-08 8:57
mentorGiorgi Dalakishvili25-Apr-08 8:57 
GeneralRe: help plz Pin
Paul Conrad25-Apr-08 9:43
professionalPaul Conrad25-Apr-08 9:43 
QuestionCodeDom Problem : How to define new object in method ? Pin
hdv21225-Apr-08 7:43
hdv21225-Apr-08 7:43 
AnswerRe: CodeDom Problem : How to define new object in method ? Pin
KaptinKrunch25-Apr-08 10:35
KaptinKrunch25-Apr-08 10:35 
QuestionSocket Programing Problem Pin
Member 448762925-Apr-08 5:33
Member 448762925-Apr-08 5:33 
Dear friends,

I'm doing the console application to listen the call information from our telephone exchange and calculate the bills. Below is the function to listen the calls and save. I'll explain the process.

1) Getting string Data from the exchange through TCP/IP.
2) Split the string and calculate call cost according to the data available in database.
3) save the calculated values in a database
4) write the calculated data in console window.

The above process is happening in round trip. Some times the SaveData(clientDataInString); function is taking more time(more than 10 sec) to complete. Mean time the exchange is sending the data for more than one call. so while receiving the data from the exchange next time i'm getting the concordinated string with more than one calls information. I cannot reduce the time of SaveData function. So i want to do the SaveData process in asynchronous manner or multi thread. Can any one help me please.


#region "Listern"

private static void Listern()
{

try
{
if (strServer == string.Empty)
{
Console.Write(" Enter server name/address: ");
strServer = Console.ReadLine();

Console.Write(" Enter remote port: ");
strPort = Console.ReadLine();
}

Console.Clear();

//IPEndPoint ipEnd = new IPEndPoint(IPAddress.Parse("10.148.146.43"), 5656);
IPEndPoint ipEnd = new IPEndPoint(IPAddress.Parse(strServer), Int32.Parse(strPort));
Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
sock.Bind(ipEnd);
sock.Listen(100);
Socket clientSock = sock.Accept();
byte[] clientData = new byte[1024];


NetworkStream ns = new NetworkStream(clientSock);
while (bActive)
{
int receivedBytesLen = ns.Read(clientData, 0, clientData.Length);
string clientDataInString = Encoding.ASCII.GetString(clientData, 0, receivedBytesLen);
ns.Flush();

// the loop should not wait if the function is getting delay. It has to just call this function and go to listen next call info immediately. for the next call info the function should start another thread. Sigh | :sigh:

//Save in sql server

SaveData(clientDataInString);

}
ns.Close();
clientSock.Close();

}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Application.Run();
}

}

#endregion
GeneralRe: Socket Programing Problem Pin
KaptinKrunch25-Apr-08 8:54
KaptinKrunch25-Apr-08 8:54 
GeneralDataGridBoolColumn Pin
michael_jhons25-Apr-08 5:32
michael_jhons25-Apr-08 5:32 
GeneralRe: DataGridBoolColumn Pin
KaptinKrunch25-Apr-08 10:45
KaptinKrunch25-Apr-08 10:45 
GeneralRe: DataGridBoolColumn Pin
michael_jhons27-Apr-08 21:21
michael_jhons27-Apr-08 21:21 
QuestionWhat is the internal function of SOAP,WSDL,UDDI in Webservice Pin
bruze25-Apr-08 5:21
bruze25-Apr-08 5:21 
GeneralC# remoting + GAC Pin
Dio2225-Apr-08 4:53
Dio2225-Apr-08 4:53 
GeneralRe: C# remoting + GAC Pin
KaptinKrunch25-Apr-08 10:47
KaptinKrunch25-Apr-08 10:47 
GeneralRe: C# remoting + GAC Pin
Dio2228-Apr-08 3:50
Dio2228-Apr-08 3:50 
QuestionConférence Pin
asma_pfe25-Apr-08 3:52
asma_pfe25-Apr-08 3:52 
GeneralRe: Conférence Pin
carbon_golem25-Apr-08 4:44
carbon_golem25-Apr-08 4:44 
GeneralRe: Conférence Pin
J4amieC25-Apr-08 4:47
J4amieC25-Apr-08 4:47 
GeneralRe: Conférence Pin
asma_pfe25-Apr-08 6:31
asma_pfe25-Apr-08 6:31 
GeneralRe: Conférence Pin
carbon_golem25-Apr-08 6:40
carbon_golem25-Apr-08 6:40 
GeneralRe: Conférence Pin
Spacix One25-Apr-08 7:06
Spacix One25-Apr-08 7:06 
AnswerRe: Conférence Pin
asma_pfe25-Apr-08 20:32
asma_pfe25-Apr-08 20:32 
QuestionDoubts of the MS Word Count of pages script Pin
Ferrarih25-Apr-08 3:34
Ferrarih25-Apr-08 3:34 
GeneralRe: Doubts of the MS Word Count of pages script Pin
Derek Bartram26-Apr-08 7:57
Derek Bartram26-Apr-08 7: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.