Click here to Skip to main content
15,891,184 members
Home / Discussions / C#
   

C#

 
GeneralRe: what is the size of reference variable Pin
Rob Philpott14-May-09 2:10
Rob Philpott14-May-09 2:10 
GeneralRe: what is the size of reference variable Pin
Luc Pattyn14-May-09 2:22
sitebuilderLuc Pattyn14-May-09 2:22 
GeneralRe: what is the size of reference variable Pin
Rob Philpott14-May-09 2:23
Rob Philpott14-May-09 2:23 
GeneralRe: what is the size of reference variable Pin
Member 103390714-May-09 1:54
Member 103390714-May-09 1:54 
GeneralRe: what is the size of reference variable Pin
Luc Pattyn14-May-09 2:08
sitebuilderLuc Pattyn14-May-09 2:08 
QuestionDrag email of Outlook Express to Winform and Save to file .eml Pin
nv_thien13-May-09 22:58
nv_thien13-May-09 22:58 
AnswerRe: Drag email of Outlook Express to Winform and Save to file .eml Pin
IrishWizKid17-Jul-09 5:40
IrishWizKid17-Jul-09 5:40 
QuestionC# TCP LOOP HELP!!! Pin
Serpendiem13-May-09 22:28
Serpendiem13-May-09 22:28 
Hey guys, for some reason this stupid TCP server doesn't loop after a client disconnects from it. How can I have it continue to loop so when people do disconnect from it, it continues to accept connections. Here is the code.


using System;
using System.Text;
using System.Net;
using System.Net.Sockets;

public class serv
{
public static void Main()
{
int c = 1234;
try
{
IPAddress ipAd = IPAddress.Parse("69.10.61.145"); //use local m/c IP address, and use the same in the client

/* Initializes the Listener */
TcpListener myList = new TcpListener(ipAd, 7575);

/* Start Listeneting at the specified port */
myList.Start();

Console.WriteLine("Login Server is running.");
Console.WriteLine("Connection :" + myList.LocalEndpoint);
Console.WriteLine("Waiting for logins...");
Console.WriteLine("================================");

Socket s = myList.AcceptSocket();
Console.WriteLine("Connection accepted from: " + s.RemoteEndPoint);

byte[] b = new byte[100];
int k = s.Receive(b);



Console.WriteLine("Login Attempt Recieved from: " + s.RemoteEndPoint);
for (int i = 0; i < k; i++)
Console.Write(Convert.ToChar(b[i]));


ASCIIEncoding asen = new ASCIIEncoding();






s.Send(asen.GetBytes("Login is invalid." + s.RemoteEndPoint));
Console.WriteLine("\nAccess Denied.");
Console.ReadLine();
return;
/* clean up */
}



catch (Exception e)
{
Console.WriteLine("Error..... " + e.StackTrace);
Console.ReadLine();
}
}

}

[X] 100% HTML
[ ] 100% PHP
[ ] 100% C#

AnswerRe: C# TCP LOOP HELP!!! Pin
OsoreWatashi13-May-09 22:50
OsoreWatashi13-May-09 22:50 
GeneralRe: C# TCP LOOP HELP!!! Pin
Serpendiem13-May-09 22:57
Serpendiem13-May-09 22:57 
AnswerRe: C# TCP LOOP HELP!!! Pin
Rob Philpott14-May-09 0:15
Rob Philpott14-May-09 0:15 
AnswerRe: C# TCP LOOP HELP!!! Pin
Programm3r14-May-09 1:13
Programm3r14-May-09 1:13 
QuestionAdd spaces to large numbers Pin
Deques13-May-09 22:20
Deques13-May-09 22:20 
AnswerRe: Add spaces to large numbers Pin
OsoreWatashi13-May-09 22:44
OsoreWatashi13-May-09 22:44 
GeneralRe: Add spaces to large numbers Pin
Deques13-May-09 23:01
Deques13-May-09 23:01 
GeneralRe: Add spaces to large numbers Pin
Mycroft Holmes13-May-09 23:14
professionalMycroft Holmes13-May-09 23:14 
GeneralRe: Add spaces to large numbers Pin
molesworth13-May-09 23:07
molesworth13-May-09 23:07 
QuestionExecuting a file from a Stream Pin
OsoreWatashi13-May-09 22:10
OsoreWatashi13-May-09 22:10 
AnswerRe: Executing a file from a Stream Pin
Dave Kreskowiak14-May-09 2:06
mveDave Kreskowiak14-May-09 2:06 
GeneralRe: Executing a file from a Stream Pin
led mike14-May-09 4:48
led mike14-May-09 4:48 
Questiontool text with gdi+ Pin
ramaluciano13-May-09 21:55
ramaluciano13-May-09 21:55 
AnswerRe: tool text with gdi+ Pin
heinrich4J24-Jan-11 20:30
professionalheinrich4J24-Jan-11 20:30 
QuestionPossible to send serialized objects from a TextWriter to a StreamReader? Pin
arnold_w13-May-09 21:45
arnold_w13-May-09 21:45 
AnswerRe: Possible to send serialized objects from a TextWriter to a StreamReader? Pin
Dave Kreskowiak14-May-09 3:51
mveDave Kreskowiak14-May-09 3:51 
GeneralRe: Possible to send serialized objects from a TextWriter to a StreamReader? Pin
arnold_w15-May-09 0:38
arnold_w15-May-09 0:38 

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.