Click here to Skip to main content
15,914,642 members
Home / Discussions / C#
   

C#

 
Generalcreate a treenode with 2 or three images Pin
chicolat15-Feb-05 4:37
susschicolat15-Feb-05 4:37 
GeneralCurrentCellChanged event !!!!!!!!!!!!!! Pin
innocent7315-Feb-05 3:53
innocent7315-Feb-05 3:53 
GeneralRe: CurrentCellChanged event !!!!!!!!!!!!!! Pin
Mr.Cooper15-Feb-05 4:01
Mr.Cooper15-Feb-05 4:01 
GeneralRe: CurrentCellChanged event !!!!!!!!!!!!!! Pin
innocent7315-Feb-05 4:14
innocent7315-Feb-05 4:14 
GeneralRe: CurrentCellChanged event !!!!!!!!!!!!!! Pin
Huseyin Altindag15-Feb-05 22:58
Huseyin Altindag15-Feb-05 22:58 
GeneralSSH Socket Programming Pin
Jason Weibel15-Feb-05 3:52
Jason Weibel15-Feb-05 3:52 
GeneralImage generation Pin
Esmo200015-Feb-05 3:49
Esmo200015-Feb-05 3:49 
GeneralUdpClient not receiving anything Pin
User 665815-Feb-05 3:42
User 665815-Feb-05 3:42 
Hi
I'm new to C# and try to send and receive UDP packets to a Counter-Strike server.
Sending packets works fine. Examining the network traffic show that I also get back a response packet from the server. But my client waiting for any UDP packets never receives any packets!
What am I doing wrong?

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

class UDPClient
{
	static void Main(string[] args)
	{
		UdpClient recv = new UdpClient();
		
//		IPEndPoint rep = new IPEndPoint(IPAddress.Any, 0);
		IPEndPoint rep = new IPEndPoint(IPAddress.Parse("217.160.132.82"), 27015);
		
		while(true)
		{
			try{
				Byte[] bytes = recv.Receive(ref rep); // THIS WAITS FOREVER
			
				string packet = Encoding.ASCII.GetString(bytes);
			
				Console.WriteLine(bytes.Length + " Bytes received.");
			}
			catch (Exception e)
			{
				Console.WriteLine(e.ToString());
			}
		}
	}
}


regards

modified 12-Sep-18 21:01pm.

GeneralRe: UdpClient not receiving anything Pin
Judah Gabriel Himango15-Feb-05 7:53
sponsorJudah Gabriel Himango15-Feb-05 7:53 
GeneralRe: UdpClient not receiving anything Pin
User 665815-Feb-05 9:02
User 665815-Feb-05 9:02 
GeneralRe: UdpClient not receiving anything Pin
User 665815-Feb-05 9:31
User 665815-Feb-05 9:31 
GeneralGet status from fax (FAXCOMLib) Pin
znize15-Feb-05 2:45
znize15-Feb-05 2:45 
GeneralHuffman algorithm Pin
iceburnbarry15-Feb-05 2:24
iceburnbarry15-Feb-05 2:24 
GeneralRe: Huffman algorithm Pin
Esmo200015-Feb-05 3:13
Esmo200015-Feb-05 3:13 
GeneralAdd a new voice to Windows context menu Pin
Anonymous15-Feb-05 2:04
Anonymous15-Feb-05 2:04 
GeneralRe: Add a new voice to Windows context menu Pin
mav.northwind15-Feb-05 3:12
mav.northwind15-Feb-05 3:12 
GeneralRe: Add a new voice to Windows context menu Pin
Anonymous15-Feb-05 5:21
Anonymous15-Feb-05 5:21 
GeneralRe: Add a new voice to Windows context menu Pin
Judah Gabriel Himango15-Feb-05 7:51
sponsorJudah Gabriel Himango15-Feb-05 7:51 
GeneralURGENT!! PLEASE HELP Pin
innocent7315-Feb-05 1:18
innocent7315-Feb-05 1:18 
GeneralRe: URGENT!! PLEASE HELP Pin
Anonymous15-Feb-05 1:37
Anonymous15-Feb-05 1:37 
GeneralRe: URGENT!! PLEASE HELP Pin
innocent7315-Feb-05 1:46
innocent7315-Feb-05 1:46 
GeneralRe: URGENT!! PLEASE HELP Pin
Anonymous15-Feb-05 1:53
Anonymous15-Feb-05 1:53 
GeneralRe: URGENT!! PLEASE HELP Pin
Stefan Troschuetz15-Feb-05 2:49
Stefan Troschuetz15-Feb-05 2:49 
GeneralRe: URGENT!! PLEASE HELP Pin
Stefan Troschuetz15-Feb-05 2:06
Stefan Troschuetz15-Feb-05 2:06 
GeneralRe: URGENT!! PLEASE HELP Pin
innocent7315-Feb-05 2:11
innocent7315-Feb-05 2:11 

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.