Click here to Skip to main content
15,887,405 members
Home / Discussions / C#
   

C#

 
GeneralSystemtray capture Pin
dubshell29-Apr-05 19:47
dubshell29-Apr-05 19:47 
Generalusb interfacing in c#.net Pin
ahsan14129-Apr-05 18:49
ahsan14129-Apr-05 18:49 
GeneralRe: usb interfacing in c#.net Pin
eggie529-Apr-05 20:31
eggie529-Apr-05 20:31 
GeneralAcessing Usb Device in C# Pin
majidbhutta29-Apr-05 17:28
majidbhutta29-Apr-05 17:28 
GeneralRe: Acessing Usb Device in C# Pin
eggie529-Apr-05 20:33
eggie529-Apr-05 20:33 
GeneralRe: Acessing Usb Device in C# Pin
Dave Kreskowiak30-Apr-05 3:38
mveDave Kreskowiak30-Apr-05 3:38 
GeneralRe: Acessing Usb Device in C# Pin
Luis Alonso Ramos30-Apr-05 8:31
Luis Alonso Ramos30-Apr-05 8:31 
GeneralSocket.LocalEndPoint is not returning expected value. Pin
johtib29-Apr-05 13:19
johtib29-Apr-05 13:19 
I'm trying to bind my socket to any local network address and to port 1337 to listen to incomming broadcasts on that port.

Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);
socket.Bind(new IPEndPoint(IPAddress.Any, 1337));


MSDN says:

"Before calling Bind, you must first create the local IPEndPoint from which you intend to communicate data. If you do not care which local address is assigned, you can create an IPEndPoint using IPAddress.Any as the address parameter, and the underlying service provider will assign the most appropriate network address. This might help simplify your application if you have multiple network interfaces. If you do not care which local port is used, you can create an IPEndPoint using 0 for the port number. In this case, the service provider will assign an available port number between 1024 and 5000.

If you use the above approach, you can discover what local network address and port number has been assigned by calling the LocalEndPoint. If you are using a connection-oriented protocol, LocalEndPoint will not return the locally assigned network address until after you have made a call to the Connect or EndConnect method. If you are using a connectionless protocol, you will not have access to this information until you have completed a send or receive."

IPEndPoint localhost = (IPEndPoint) socket.LocalEndPoint;
Console.WriteLine("LocalEndPoint: {0}", localhost.Address);


Prints: "LocalEndPoint: 0.0.0.0" but by sniffing the NIC (using Ethereal) I can see that packets sent using socket.SendTo(sendBuf, new IPEndPoint(IPAddress.Broadcast, 1337)); originates from the IP 192.168.0.100 (my machine's WLAN NIC). Why isn't this IP address reported by socket.LocalEndPoint? I need to know the address assigned!
GeneralRe: Socket.LocalEndPoint is not returning expected value. Pin
EssOEss30-Apr-05 19:55
EssOEss30-Apr-05 19:55 
GeneralRe: Socket.LocalEndPoint is not returning expected value. Pin
johtib30-Apr-05 22:37
johtib30-Apr-05 22:37 
GeneralRe: Socket.LocalEndPoint is not returning expected value. Pin
EssOEss1-May-05 0:44
EssOEss1-May-05 0:44 
GeneralThis is very strange... Pin
Nick Z.29-Apr-05 12:41
Nick Z.29-Apr-05 12:41 
GeneralRe: This is very strange... Pin
Nick Z.29-Apr-05 15:01
Nick Z.29-Apr-05 15:01 
QuestionManagement namespace a member of System? Pin
CTaylor8929-Apr-05 10:32
CTaylor8929-Apr-05 10:32 
AnswerRe: Management namespace a member of System? Pin
Fernando Soto29-Apr-05 11:06
Fernando Soto29-Apr-05 11:06 
GeneralRe: Management namespace a member of System? Pin
CTaylor8929-Apr-05 11:55
CTaylor8929-Apr-05 11:55 
GeneralRe: Management namespace a member of System? Pin
Anonymous30-Apr-05 23:32
Anonymous30-Apr-05 23:32 
GeneralContext menu for TabControl Pin
giplet29-Apr-05 10:25
giplet29-Apr-05 10:25 
GeneralRe: Context menu for TabControl Pin
Ashok Dhamija29-Apr-05 23:07
Ashok Dhamija29-Apr-05 23:07 
GeneralRe: Context menu for TabControl Pin
giplet30-Apr-05 5:29
giplet30-Apr-05 5:29 
GeneralChanging standard windows title bars Pin
dubshell29-Apr-05 10:12
dubshell29-Apr-05 10:12 
Generalconnect to oracle without DSN Pin
IvyLee29-Apr-05 9:58
IvyLee29-Apr-05 9:58 
GeneralDrawString with extra spaces Pin
Werdna29-Apr-05 9:11
Werdna29-Apr-05 9:11 
QuestionWindows Installer C# api? Pin
DStarr29-Apr-05 8:48
DStarr29-Apr-05 8:48 
GeneralMdi form AutoScroll property Pin
M. Aamir Malik29-Apr-05 7:11
M. Aamir Malik29-Apr-05 7: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.