C# or .NET remoting - Question Updated.

Jassi

Diamond Member
Sep 8, 2004
3,296
0
0

EDIT -

Alright, I got Sockets to work with C# (Still not C++ but its a start and I used a template from a tutorial). Now I need to know what the best method is to integrate the C# Socket code with my existing C++ code. Keep in mind that I need to make this program run in Win 98 or possibly even DOS.

Jassi

-----
Here is what I need to make:

There is a C++ program that needs to communicate to another C++ program accross a local network or even the internet (if possible). The programs will only send 1 small matrix (1 x 8) of integers back and forth with maybe a few error codes and such misc. data. I have looked into Winsock2 but its a little harder to implement than I would like. I have heard of C# remoting but I am still not sure if I can apply it to my needs. Can someone please tell me if its feasible and what challenges I will face while trying to integrate C# with C++? I am already using the Microsoft compiler for my C++ code.

Thanks,
Jassi
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
We're still a MFC shop so no idea, but most of the examples you find will probably be client-server and it sounds like you're talking about peer-to-peer?

For client-server, the "wininet" classes might do what you need without needing to change languages, look it up in the MSDN / books online docs.
 

Jassi

Diamond Member
Sep 8, 2004
3,296
0
0
Originally posted by: bersl2
Man up; use sockets. :p

So you are are voice in my head that I will be ignoring?


;)


Seriously though, if you know sockets well, wanna help?
 

oog

Golden Member
Feb 14, 2002
1,721
0
0
if you're building both sides of the program, why not use sockets? you just open one and start writing data. on the other side, you listen and read data. on the other hand, web services do give you a nice language abstraction and often comes with toolkits for serializing your data.
 

Jassi

Diamond Member
Sep 8, 2004
3,296
0
0
Well I am new to this and on a tight deadline so I am doubly stressed. Everything sounds good until I try it and doesn't work ;)

I need help with sockets :(
 

torpid

Lifer
Sep 14, 2003
11,631
11
76
Web services may be unnecessarily complicated. If this needs to be a near instant transfer, it should be eliminated as an option entirely.

C# remoting is a bit of overhead and complication. Basically you create an object and you transfer the serialized form of it (preferably binary) over TCP/IP. If you are uncomfortable with sockets you might find this an easier solution, as there are a lot of examples and visual studio.net might even generate some skeleton code for you.
 

KB

Diamond Member
Nov 8, 1999
5,406
389
126
Do not use C# Remoting. Microsoft is moving away from the technology towards their Indigo communications protocol. I would use a Web Service if possible, or staight sockets. If you can use C#, the sockets implementation is easy to learn from the SDK documentation.
 

zebano

Diamond Member
Jun 15, 2005
4,042
0
0
web services are very straightforward and easier to learn than sockets (higher level of abstraction). For c# you can start most any search at www.msdn.com (though there is often better documentation elsewhere).

Edit: sorry I missed the integration with c++ piece. Sockets will probably be the easiest solution.
 

MageXX9

Senior member
Jan 25, 2005
442
0
0
With such a small amount of data, definitely use sockets. It's seems very simple to me, (in a mutli-threaded application) have a thread block on reading the socket, when the amount of data (8x1 matrix of ints) is read, handle it. Loop. Reading from a socket is just like reading from a file. hth, it can be quite a bit more complicated but it's basic Inter-Process Communication.

And don't forget endianess... if that's an issue.

PM/AIM/email if you need help.
 

Jassi

Diamond Member
Sep 8, 2004
3,296
0
0
Alright, I got Sockets to work with C# (Still not C++ but its a start). Now I need to know what the best method is to integrate the C# Socket code with my existing C++ code. Keep in mind that I need to make this program run in Win 98 or possibly even DOS.
 

bersl2

Golden Member
Aug 2, 2004
1,617
0
0
or possibly even DOS.

Um, do you have the right tools for DOS? Ethernet driver (or will you use serial ports)? TCP/IP stack? DOS is just that incomplete when it comes to networking.
 

MageXX9

Senior member
Jan 25, 2005
442
0
0
I doubt he meant DOS, maybe a DOS window. If a DOS window then it's still using the operating system library code. I would start with that, the OS library code for the TCP/IP socket API.

I used a book during school, Steven's book on Network Programming, it is *the* book for socket programming, and it contains wrapper functions that are quite helpful if you can get it to build on your system.


hth
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
in mind that I need to make this program run in Win 98 or possibly even DOS.
For Win98 you could use winsock or wininet in C++ now that you have a c# design to copy / convert to C++.

For DOS buy some paper cups and string. *




* actually your network card might have come with DOS drivers, and you might find some DOS-compatible TCP/IP code somewhere. Isn't DOOM1 open-source now?
 

Jassi

Diamond Member
Sep 8, 2004
3,296
0
0
I am at best a novice so I lack the skills needed to extract the code from a game :(