![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: May 2005
Location: ma
Posts: 130
Rep Power: 4
![]() |
using sockets to connect between ms and *nix
hi i want to make a simple file tranfers program so me and my friend can connect to each other (have had less then steller success with gaim) Im familar with how sockets work in *nix because everything is a file. Im not sure how they work in ms tho. is it very similar so that my knowledge of socket programming may be enough or vastly different that i'll have to go into more depth of programming for windows?
|
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() ![]() |
Beej's Guide to Network Programming
http://www.ecst.csuchico.edu/~beej/g...tro.html#AEN52 Jim Frost's "Windows Sockets: A Quick And Dirty Primer" is a short introduction to programming Winsock. There is also a complementary Unix version of that tutorial at the same site. http://www.frostbytes.com/~jimf/pape...s/winsock.html
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
Join Date: May 2005
Location: ma
Posts: 130
Rep Power: 4
![]() |
thanks. i've read the first one from page oen to the end and enjoyed it. i'll take a look at the winsocks one.
|
|
|
|
|
|
#4 |
|
Programming Guru
![]() ![]() ![]() |
Sounds good... hope it helps.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#5 |
|
Professional Programmer
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 317
Rep Power: 4
![]() |
I think all the useful answers have been given here, maybe bar one: have you considered using a portable high level language? That way, sockets will work in exactly the same way on both platforms. I'm thinking of Tcl/Tk, mainly, here, but you could say the same of Perl, Java and (I think) Python. They way sockets work in these languages is usually built around the BSD Sockets API and very reminiscent of it, if often a little simpler.
You might find you get the job done a lot faster, and it may save you learning the quirks of Windows sockets, which may have been worth learning five years ago but I suspect they'll lose their relevance (surely MS will manage to implement 'proper sockets' on their tinkertoy platform sometime soon?). |
|
|
|
|
|
#6 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Try this, under Basic How-To, and maybe this, which is a PDF.
It it's a good idea to use what someone else has done, as just mentioned by McKenga, unless you're out for the learning.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#7 | |
|
Newbie
Join Date: Sep 2005
Posts: 3
Rep Power: 0
![]() |
Quote:
Well, I am able to connect, but I am having trouble sending multiple send(). Client code: (C++ code in Windows 2000 Professional) char ch[3] = "AB"; char ch2[2] = "w"; send(sd, ch, sizeof(ch), 0); send(sd, ch2, sizeof(ch2), 0); Server code: (C code on QNXOS) char buff[3]; char buff2[2]; int len1,len2; len1 = recv(ns,&buff,sizeof(buff),0); len2 = recv(ns,&buff2,sizeof(buff2),0); printf("Data1: %s\n", &buff); printf("Data1: %\ns", &buff2); printf("Len1: %i\n", len1); printf("Len2: %i\n", len2); Output on Server: Data1: AB Data2: 2AB Len1: 3 Len2: -1 THANKS |
|
|
|
|
|
|
#8 |
|
Programming Guru
![]() ![]() ![]() |
may want to start a new thread with this particular code.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#9 |
|
Professional Programmer
Join Date: Jun 2005
Location: India, The great.
Posts: 435
Rep Power: 4
![]() |
... and learn to use the Code Tags.
__________________
PFO - My daily dose of technology. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|