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

C#

 
AnswerRe: C# Newbie: What is the ":" for?? Pin
V.10-Aug-06 3:15
professionalV.10-Aug-06 3:15 
AnswerRe: C# Newbie: What is the ":" for?? Pin
Roy Heil10-Aug-06 3:17
professionalRoy Heil10-Aug-06 3:17 
AnswerRe: C# Newbie: What is the ":" for?? Pin
Ennis Ray Lynch, Jr.10-Aug-06 4:13
Ennis Ray Lynch, Jr.10-Aug-06 4:13 
AnswerRe: C# Newbie: What is the ":" for?? [modified] Pin
LongRange.Shooter10-Aug-06 7:50
LongRange.Shooter10-Aug-06 7:50 
GeneralRe: C# Newbie: What is the ":" for?? Pin
Ennis Ray Lynch, Jr.10-Aug-06 8:23
Ennis Ray Lynch, Jr.10-Aug-06 8:23 
JokeRe: C# Newbie: What is the ":" for?? Pin
LongRange.Shooter10-Aug-06 10:34
LongRange.Shooter10-Aug-06 10:34 
Questionclient/server problem Pin
aeliminate10-Aug-06 2:20
aeliminate10-Aug-06 2:20 
AnswerRe: client/server problem Pin
Andrei Ungureanu10-Aug-06 2:37
Andrei Ungureanu10-Aug-06 2:37 
hi,
Try this code
<code>
//Server
Socket server = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
server.Bind(new IPEndPoint(IPAddress.Any,20000));
m_tcpListener.Listen(50);
Socket client = server.Accept(); // wait for a client to connect
string message = "Testing 1,2,3";
client.Send(Encoding.ASCII.GetBytes(message));
client.Shutdown(SocketShutdown.Both);
client.Close();
server.Close();

//Client
Socket client = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
client.Connect(new IPEndPoint(Dns.Resolve("127.0.0.1").AddressList[0],1000));
byte []buffer = new byte[1024];
int read = client.Receive(buffer);
Console.WriteLine(Encoding.ASCII.GetString(buffer,0,read));
</code>

It's just a simple example in which a server waits for a client to connect then sends to the client a message, and the client prints the received message. Hope it's a start for you.

Do your best to be the best
GeneralRe: client/server problem Pin
aeliminate10-Aug-06 3:21
aeliminate10-Aug-06 3:21 
GeneralRe: client/server problem Pin
Andrei Ungureanu10-Aug-06 7:31
Andrei Ungureanu10-Aug-06 7:31 
Questionhow to find the word present in the document Pin
ayyp10-Aug-06 2:08
ayyp10-Aug-06 2:08 
AnswerRe: how to find the word present in the document Pin
Not Active10-Aug-06 3:26
mentorNot Active10-Aug-06 3:26 
GeneralRe: how to find the word present in the document Pin
ayyp10-Aug-06 19:07
ayyp10-Aug-06 19:07 
GeneralRe: how to find the word present in the document Pin
Khalid Sabtan3-Jul-12 12:15
Khalid Sabtan3-Jul-12 12:15 
Questiongracefull exit Pin
Glen Harvy10-Aug-06 1:59
Glen Harvy10-Aug-06 1:59 
AnswerRe: gracefull exit Pin
Not Active10-Aug-06 2:52
mentorNot Active10-Aug-06 2:52 
AnswerRe: gracefull exit Pin
Stefan Troschuetz10-Aug-06 2:54
Stefan Troschuetz10-Aug-06 2:54 
GeneralRe: gracefull exit Pin
Glen Harvy10-Aug-06 12:30
Glen Harvy10-Aug-06 12:30 
GeneralRe: gracefull exit Pin
Stefan Troschuetz10-Aug-06 22:16
Stefan Troschuetz10-Aug-06 22:16 
AnswerRe: gracefull exit Pin
Ennis Ray Lynch, Jr.10-Aug-06 4:15
Ennis Ray Lynch, Jr.10-Aug-06 4:15 
GeneralRe: gracefull exit Pin
Glen Harvy10-Aug-06 12:36
Glen Harvy10-Aug-06 12:36 
AnswerRe: gracefull exit Pin
likefood10-Aug-06 9:41
likefood10-Aug-06 9:41 
QuestionSOAP Attachments - c# and java Pin
teluksridhar10-Aug-06 1:18
teluksridhar10-Aug-06 1:18 
QuestionDebugging SP with Sql server 2005. Pin
Ankit_748110-Aug-06 1:12
Ankit_748110-Aug-06 1:12 
QuestionExternal function Pin
thepersonof10-Aug-06 1:06
thepersonof10-Aug-06 1:06 

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.