C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 4th, 2003, 06:50 AM
Mammoth Mammoth is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 6 Mammoth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Mammoth Send a message via Yahoo to Mammoth
recv() only accepting one character (winsock2)

I use the recv() function like this:

int msgLength = recv(sockMain, buf, 20, MSG_PEEK);

No errors are reported by the return value, but recv() seems to only accept one character. It stops recv()-ing after I enter one character from the client. Is there a reason for this?

If i set the flag to MSG_OOB, which seemed to be the only thing I could have gone wrong at, it doesn't stop recieving...

Any help appreciated

*Edit: I use winsock2.

Reply With Quote
  #2  
Old August 4th, 2003, 02:55 PM
infamous41md's Avatar
infamous41md infamous41md is offline
not a fan of fascism (n00b)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Feb 2003
Location: ct
Posts: 2,756 infamous41md User rank is Sergeant (500 - 2000 Reputation Level)infamous41md User rank is Sergeant (500 - 2000 Reputation Level)infamous41md User rank is Sergeant (500 - 2000 Reputation Level)infamous41md User rank is Sergeant (500 - 2000 Reputation Level)infamous41md User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 11 h 4 m 29 sec
Reputation Power: 26
you should be setting the last parameter to 0 to do normal reads.

Reply With Quote
  #3  
Old August 5th, 2003, 02:59 AM
Mammoth Mammoth is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 6 Mammoth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Mammoth Send a message via Yahoo to Mammoth
I thought MSG_PEEK was a macro for 0? Anyway, it doesn't work either

Reply With Quote
  #4  
Old August 5th, 2003, 03:33 AM
infamous41md's Avatar
infamous41md infamous41md is offline
not a fan of fascism (n00b)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Feb 2003
Location: ct
Posts: 2,756 infamous41md User rank is Sergeant (500 - 2000 Reputation Level)infamous41md User rank is Sergeant (500 - 2000 Reputation Level)infamous41md User rank is Sergeant (500 - 2000 Reputation Level)infamous41md User rank is Sergeant (500 - 2000 Reputation Level)infamous41md User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 11 h 4 m 29 sec
Reputation Power: 26
where's the rest of the code? what is being sent? are you sending it correctly?

Reply With Quote
  #5  
Old August 5th, 2003, 04:04 AM
TechNoFear TechNoFear is offline
Offensive Member
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2002
Location: in the perfect world
Posts: 594 TechNoFear User rank is Sergeant (500 - 2000 Reputation Level)TechNoFear User rank is Sergeant (500 - 2000 Reputation Level)TechNoFear User rank is Sergeant (500 - 2000 Reputation Level)TechNoFear User rank is Sergeant (500 - 2000 Reputation Level)TechNoFear User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 14 h 6 m 15 sec
Reputation Power: 22
Are you sending only one byte at a time?

Are you calling recv() until it returns an error or 0 (no more data) ?
__________________
The essence of Christianity is told us in the Garden of Eden history. The fruit that was forbidden was on the Tree of Knowledge. The subtext is, All the suffering you have is because you wanted to find out what was going on. You could be in the Garden of Eden if you had just kept your f***ing mouth shut and hadn't asked any questions.

Frank Zappa

Reply With Quote
  #6  
Old August 5th, 2003, 01:02 PM
Mammoth Mammoth is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 6 Mammoth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Mammoth Send a message via Yahoo to Mammoth
I seem to have found the problem. I was using telnet to test out my server. I wrote up a quick TCP Client, and transmitted over that, and it worked fine. I suppose it causes telnet to transmit as soon as It recieves input.

Anyway, thanks for the help guys.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > recv() only accepting one character (winsock2)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT