Click here to Skip to main content
15,908,901 members
Home / Discussions / C#
   

C#

 
GeneralRe: passing parameters to a DLL function receiving pointer Pin
devinzhang12-Dec-05 9:58
devinzhang12-Dec-05 9:58 
AnswerRe: passing parameters to a DLL function receiving pointer Pin
Jared Parsons12-Dec-05 11:40
Jared Parsons12-Dec-05 11:40 
GeneralRe: passing parameters to a DLL function receiving pointer Pin
devinzhang12-Dec-05 12:08
devinzhang12-Dec-05 12:08 
QuestionSigning CodeDom assemblies Pin
cbadal12-Dec-05 8:00
cbadal12-Dec-05 8:00 
AnswerRe: Signing CodeDom assemblies Pin
cbadal14-Dec-05 7:08
cbadal14-Dec-05 7:08 
QuestionDatagrid ghost selection Pin
Glenn E. Lanier II12-Dec-05 6:29
Glenn E. Lanier II12-Dec-05 6:29 
QuestionUDP port not receiving any data Pin
MullahOmer12-Dec-05 6:14
MullahOmer12-Dec-05 6:14 
AnswerRe: UDP port not receiving any data Pin
mcljava12-Dec-05 7:44
mcljava12-Dec-05 7:44 
When you bind the 127.0.0.1 you are creating a looback binding that is available on your machine only. The loopback address is a special IP that bypasses the core logic of TCP/IP driver so that messages can simply be routed intra-machine w/o having to undergo the packet processing required for inter-machine communication. Thus you can start by creating an end point to the actual IP address. Now if your computer uses DHCP to acquire an IP then you will have to deal with passing it as a command line or windows form parameter, or possibly just use a static IP instead. Secondly since UDP is connectionless why are you binding the socket? Finally go with the Managed UDP interface unless you truely have a reason to drop down to the native socket interface.

All you really need for UDP is:

UdpClient client = new UdpClient(8129);<br />
<br />
// accept from any host<br />
IPEndPoint remoteEndPoint = new IPEndPoint(0,0);<br />
<br />
// receive a message and convert to ASCII<br />
byte[] datagram = client.Receive(ref remoteEndPoint);<br />
string dataReceived = System.Text.Encoding.ASCII.GetString(datagram);<br />
<br />
// Send a message back to the server from whence message came<br />
string request = "Thanks";<br />
byte[] packet = System.Text.Encoding.ASCII.GetBytes(request.ToCharArray());<br />
client.Send(packet, packet.Length, remoteEndPoint);<br />


Good luck with C#

Mike Luster
QuestionThoughtpost P2P Pin
ShimiG12-Dec-05 6:07
ShimiG12-Dec-05 6:07 
AnswerRe: Thoughtpost P2P Pin
Dave Kreskowiak12-Dec-05 6:29
mveDave Kreskowiak12-Dec-05 6:29 
GeneralRe: Thoughtpost P2P Pin
ShimiG12-Dec-05 6:40
ShimiG12-Dec-05 6:40 
GeneralRe: Thoughtpost P2P Pin
Dave Kreskowiak12-Dec-05 10:07
mveDave Kreskowiak12-Dec-05 10:07 
QuestionAn existing connection was forcibly closed by the remote host Pin
Ricardo Mendes12-Dec-05 6:03
Ricardo Mendes12-Dec-05 6:03 
AnswerRe: An existing connection was forcibly closed by the remote host Pin
Jared Parsons12-Dec-05 6:13
Jared Parsons12-Dec-05 6:13 
GeneralRe: An existing connection was forcibly closed by the remote host Pin
Ricardo Mendes12-Dec-05 6:16
Ricardo Mendes12-Dec-05 6:16 
GeneralRe: An existing connection was forcibly closed by the remote host Pin
Jared Parsons12-Dec-05 8:45
Jared Parsons12-Dec-05 8:45 
GeneralRe: An existing connection was forcibly closed by the remote host Pin
Ricardo Mendes13-Dec-05 0:57
Ricardo Mendes13-Dec-05 0:57 
GeneralRe: An existing connection was forcibly closed by the remote host Pin
Jared Parsons13-Dec-05 7:48
Jared Parsons13-Dec-05 7:48 
QuestionDelegates Pin
DELETEUSER12-Dec-05 5:57
DELETEUSER12-Dec-05 5:57 
AnswerRe: Delegates Pin
Roy Heil12-Dec-05 7:15
professionalRoy Heil12-Dec-05 7:15 
AnswerRe: Delegates Pin
Gerben Jongerius12-Dec-05 8:27
Gerben Jongerius12-Dec-05 8:27 
GeneralRe: Delegates Pin
Den2Fly12-Dec-05 10:25
Den2Fly12-Dec-05 10:25 
GeneralRe: Delegates Pin
Gerben Jongerius13-Dec-05 3:55
Gerben Jongerius13-Dec-05 3:55 
GeneralRe: Delegates Pin
Den2Fly14-Dec-05 4:27
Den2Fly14-Dec-05 4:27 
AnswerRe: Delegates Pin
Den2Fly12-Dec-05 18:49
Den2Fly12-Dec-05 18:49 

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.