C++ UDP Network Help : XPlane Simulator Program

D

Da Vinci

Hello,

I am starting a project that requires data transfer via UDP. It will
be between two different computers. I have all of the information that
needs to be sent in the packet and what the return packets are. What I
do not know is how to open a UDP connection in C++ and structure the
packet to send.

This is for a home built simulator running the X-Plane software. The
sim will be on one computer and is configurable to send data out to a
specified IP address and also to bring in data sent to it. The program
I need to make will be on the other computer that has all the hardware
attached to it. I already have the hardware figured out and have a
program to control all the I/O to it.

If anyone out there could suggest a book on the subject, point me to
some commented source code, post examples of source code, or anything
else, I would be much appreciative. My C++ is a little rusty and not
to advanced. I can do all of the loops, arrays, pointers, and class
stuff but that is about it.

Many Thanks in Advance.
 
M

MSR

Da Vinci said:
Hello,

I am starting a project that requires data transfer via UDP. It will
be between two different computers. I have all of the information that
needs to be sent in the packet and what the return packets are. What I
do not know is how to open a UDP connection in C++ and structure the
packet to send.

This is for a home built simulator running the X-Plane software. The
sim will be on one computer and is configurable to send data out to a
specified IP address and also to bring in data sent to it. The program
I need to make will be on the other computer that has all the hardware
attached to it. I already have the hardware figured out and have a
program to control all the I/O to it.

If anyone out there could suggest a book on the subject, point me to
some commented source code, post examples of source code, or anything
else, I would be much appreciative. My C++ is a little rusty and not
to advanced. I can do all of the loops, arrays, pointers, and class
stuff but that is about it.

Many Thanks in Advance.

You could try reading Richard Steven's Unix Network Programming to
understand the concepts. If you want to a quick route and need c++ sockets
libray take a look at http://www.alhem.net/Sockets/.
 
V

Victor Bazarov

Da said:
I am starting a project that requires data transfer via UDP. It will
be between two different computers. I have all of the information that
needs to be sent in the packet and what the return packets are. What I
do not know is how to open a UDP connection in C++ and structure the
packet to send.

Unfortunately, Standard C++ language, the topic of this newsgroup, does
not have any facilities to help you with that. You need to ask your
OS-specific question in a newsgroup for your OS.
[...]

If anyone out there could suggest a book on the subject, point me to
some commented source code, post examples of source code, or anything
else, I would be much appreciative. My C++ is a little rusty and not
to advanced. I can do all of the loops, arrays, pointers, and class
stuff but that is about it.

I am fairly certain that network programming has been discussed in the
newsgroup for your OS and is probably part of any programming book that
deals with your OS. You could start by searching the archives (go to
http://groups.google.com) for any discussions on programming networks
in your OS.

V
 
D

Da Vinci

Unfortunately, Standard C++ language, the topic of this newsgroup, does
not have any facilities to help you with that. You need to ask your
OS-specific question in a newsgroup for your OS.
I am fairly certain that network programming has been discussed in the
newsgroup for your OS and is probably part of any programming book that
deals with your OS. You could start by searching the archives (go to
http://groups.google.com) for any discussions on programming networks
in your OS.

V


Shows how little I know of the scope of C++. I was under the
assumption networking was a part of the language, not spefic to OS.

Thanks.
 
I

Ioannis Vranos

Da said:
Hello,

I am starting a project that requires data transfer via UDP. It will
be between two different computers. I have all of the information that
needs to be sent in the packet and what the return packets are. What I
do not know is how to open a UDP connection in C++ and structure the
packet to send.

This is for a home built simulator running the X-Plane software. The
sim will be on one computer and is configurable to send data out to a
specified IP address and also to bring in data sent to it. The program
I need to make will be on the other computer that has all the hardware
attached to it. I already have the hardware figured out and have a
program to control all the I/O to it.

If anyone out there could suggest a book on the subject, point me to
some commented source code, post examples of source code, or anything
else, I would be much appreciative. My C++ is a little rusty and not
to advanced. I can do all of the loops, arrays, pointers, and class
stuff but that is about it.


You will have to use some OS library. In fact these days I am learning .NET networking.
Unfortunately UDP/datagrams is in later pages than what I have read so far, but I can tell
you that if you are using .NET, you will use the member functions Socket::SendTo() and
Socket::ReceiveFrom() which are for UDP/datagrams connectionless data transfers.
 
I

Ioannis Vranos

Ioannis said:
You will have to use some OS library. In fact these days I am learning
.NET networking. Unfortunately UDP/datagrams is in later pages than what
I have read so far, but I can tell you that if you are using .NET, you
will use the member functions Socket::SendTo() and Socket::ReceiveFrom()
which are for UDP/datagrams connectionless data transfers.


Also keep in mind that networking involves multithreading, if you do not want the program
interface freezing while sending or receiving data, or not being able to send or receive
any data while processing the previous data.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top