Free Downloads, Community Forum,
FAQs and Developer Resources


Make /Tools Your Home | Link to us

Today's posts | Posts since last visit | Most Active Topics

All Forums Register Login Search Subscriptions My Profile Inbox
Tool Warehouse FAQs Resources Help Member List Address Book Logout

ioctl does not work

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [SFU / Interix / SUA Technology] >> Windows Server 2003 R2 SUA >> ioctl does not work Page: [1]
Login
Message << Older Topic   Newer Topic >>
ioctl does not work - Jun. 26, '06, 4:38:00 AM   
shailishi

 

Posts: 15
Joined: Jan. 6, '06,
Status: offline
ioctl call does not give correct information about the data available on socket read buffer Interix. Is there any other call that can be used for obtaining information about the bytes available in socket buffer to read and how this can be used? Thanks
Post #: 1
RE: ioctl does not work - Jun. 26, '06, 11:49:59 AM   
Rodney

 

Posts: 3695
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
Which ioctl request? It helps if you name it.

(in reply to shailishi)
Post #: 2
RE: ioctl does not work - Jun. 26, '06, 11:57:28 AM   
shailishi

 

Posts: 15
Joined: Jan. 6, '06,
Status: offline
Thanks for reply.
it is FIONREAD request for socket (to read available bytes on socket buffer).
Thanks,

(in reply to shailishi)
Post #: 3
RE: ioctl does not work - Jun. 26, '06, 2:45:00 PM   
Rodney

 

Posts: 3695
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
FIONREAD is the only ioctl request for seeing what's available (in bytes) to read.
This request applies to other types of file descriptors besides sockets.
It's difficult of this request to mess up since it only sets a value (bytes available).
Why do you think it is not working?

(in reply to shailishi)
Post #: 4
RE: ioctl does not work - Jun. 27, '06, 12:05:14 AM   
shailishi

 

Posts: 15
Joined: Jan. 6, '06,
Status: offline
We are migrating one of our linux server apllication to Windows 2003-SUA. We saw that ioctl call always returns a larger value(in the range 500000 somtimes) but when we call recvfrom to read available data, recvfrom returns much less data in the buffer(most of the time it is less then 200 bytes). Also sometime recvfrom returns 'connection reset error', for open connections.
Thanks

(in reply to shailishi)
Post #: 5
RE: ioctl does not work - Jun. 27, '06, 1:16:09 AM   
Rodney

 

Posts: 3695
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
Well... recvfrom() was introduced in 5.2/SUA and there have been reports of
this API not always working correctly. The use of recvfrom() can usually
be replaced with recv() since most code doesn't use revfrom() for
sending file handles. Recv() has been good for the past 10 years. I'd suggest
any matching sendto()'s to send()'s for balance.
If you've been using the scatter/gather of sendto/recvfrom then blending it into
a single memory point is easy enough. Or you can use libport which will
do this conversion for you (meaning it's a makefile change rather than a source
code change).

Doing this should clear up the reset thing. I don't know if as a side effect this
would correct the ioctl() return, but "you never know until ya try".

Otherwise you'll have to contact MS support (PSS) to report the bug and see what
can be done for you.

(in reply to shailishi)
Post #: 6
RE: ioctl does not work - Jul. 28, '06, 5:38:39 AM   
RSanjay

 

Posts: 2
Joined: Apr. 27, '06,
Status: offline
recvmsg/sendmsg is added in SUA.
recvfrom/sendto is available in previous releases also.
If it is INET socket then recvfrom works fine on SUA/3.5.
For the ioctl behavior, please check the sendto call parameters more precisely size of buffer (IIIrd argument).

A snapshot of sendto usage and its effect on recvfrom:

char buf[2024];
"if(sendto(sd, buf, ****strlen(buf)****, 0, (struct sockaddr *)&server_addr, sizeof(server_addr))"

Output From SUA m/c and SFU 3.5:
/tmp > a.out
sendto: passed data= Hi from client...............size 765
ioctl ret = 0 bufsize = 765
recvfrom: got=[Hi from clientHi.................] size = 765


"if(sendto(sd, buf, ****sizeof(buf)****, 0, (struct sockaddr *)&server_addr, sizeof(server_addr))"

Output From SUA m/c and SFU 3.5:
/tmp > a.out
sendto: passed data= Hi from client...............size 765
ioctl ret = 0 bufsize = 2024
recvfrom: got=[Hi from clientHi.................] size = 765

This can be the case of ioctl giving different value and recvfrom returning different one as raised by shailishi.This behaviour is seen on other posix complaint OS's.
[Note: Ioctl API is not applicable on local sockets on SUA and for local DGRAM sockets, recvmsg/sendmsg is suggested.]

(in reply to Rodney)
Post #: 7
Page:   [1]
All Forums >> [SFU / Interix / SUA Technology] >> Windows Server 2003 R2 SUA >> ioctl does not work Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Search All Forums -

Advanced search


SPONSORS



Forum Software © ASPPlayground.NET Advanced Edition 2.5 ANSI

0.047