Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with CSockets and connectivity over the internet

Status
Not open for further replies.

qednick

Programmer
Jul 26, 2002
516
US
Hi, I'm trying to develop a simple windows application that can somehow "speak" to another program or java servlet on a web server. For example, let's say I have a current internet connection, I would like to enter some text on the Windows client program, click a button or something, and that particular string of text then gets sent down the phone line and is captured and "read" by the program/servlet on the web server. The server program could then do something interesting with that string of text and send it straight back to the client program on my PC.

Only thing is, I have never dipped my toes in this area before. I have looked at the MSDN samples, etc. but still nothing is very clear to me. Also, I cannot get the "chatter" example to build (link error). If someone could tell me how to go about the sending/receiving of the information (in layman's terms) over the internet by use of sockets (or whatever) I would be very grateful.

Thanks
 
for the link error, did you link to wsock32.lib (i think that that's the name of the library file)?
 
Hi guys, thanks for the responses. Firstly, yes I cured the link error during build. However, I have some concerns regarding the use of sockets:

As far as I can tell (from material I've found in books and on the net, etc) using sockets can be unreliable. Is this true?

Secondly, for anyone who is interested to know... I've found it is entirely possible to make uni-directional calls to a cgi script or java servlet (based on a web server) from a windows program written in C++ over an internet connection using the CInternetSession/CHttpFile classes. The only drawback appears to be the fact that information has to be exchanged in 'text' format (either 'text\plain' or 'text\html').

Bi-directional communication can be simulated by making the windows program repeatedly call the cgi/servlet at set intervals for updated information.

I believe that this level of http communication does not suffer from any limitations that sockets may have (eg. ability to run behind a firewall, etc).

I would be interested to hear any comments anyone may have on the subject.
 

If you're using MFC the sockets are included in the stdAfx.h file (#include <afxsock.h>) if you selected sockets in the MFC wizard. If not link to Ws2_32.lib in the Project, Settings, Link dialog.

Hope this helps,

Brother C
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top