Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 29th, 2005, 10:44 AM   #1
linuxpimp20
Hobbyist Programmer
 
Join Date: May 2005
Location: ma
Posts: 130
Rep Power: 4 linuxpimp20 is on a distinguished road
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?
linuxpimp20 is offline   Reply With Quote
Old Aug 29th, 2005, 11:07 AM   #2
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
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."
Infinite Recursion is offline   Reply With Quote
Old Aug 29th, 2005, 11:12 AM   #3
linuxpimp20
Hobbyist Programmer
 
Join Date: May 2005
Location: ma
Posts: 130
Rep Power: 4 linuxpimp20 is on a distinguished road
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.
linuxpimp20 is offline   Reply With Quote
Old Aug 30th, 2005, 9:02 AM   #4
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
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."
Infinite Recursion is offline   Reply With Quote
Old Aug 31st, 2005, 6:01 AM   #5
mackenga
Professional Programmer
 
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 317
Rep Power: 4 mackenga is on a distinguished road
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?).
mackenga is offline   Reply With Quote
Old Aug 31st, 2005, 7:17 AM   #6
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Sep 29th, 2005, 4:29 PM   #7
ashucool83
Newbie
 
Join Date: Sep 2005
Posts: 3
Rep Power: 0 ashucool83 is on a distinguished road
Quote:
Originally Posted by linuxpimp20
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?
Hi .. I am also trying to do something smiliar. I have a C++ code running on Win2000 machine trying to access C server code in QNX-OS.
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
ashucool83 is offline   Reply With Quote
Old Sep 29th, 2005, 5:10 PM   #8
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
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."
Infinite Recursion is offline   Reply With Quote
Old Sep 30th, 2005, 8:23 AM   #9
InfoGeek
Professional Programmer
 
InfoGeek's Avatar
 
Join Date: Jun 2005
Location: India, The great.
Posts: 435
Rep Power: 4 InfoGeek is on a distinguished road
... and learn to use the Code Tags.
__________________
PFO - My daily dose of technology.
InfoGeek is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:02 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC