• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem in leopard regarding socket shutdown
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem in leopard regarding socket shutdown


  • Subject: Re: Problem in leopard regarding socket shutdown
  • From: "parag vibhute" <email@hidden>
  • Date: Sat, 29 Dec 2007 12:01:41 +0530

I just created an UDP socket & then using "recvfrom" & "sendto" APIs to send &  receive data from server.

Thanks,
Parag

On Dec 29, 2007 12:29 AM, Rob Newberry < email@hidden> wrote:
Yes, "shutdown" returns an error for an unconnected socket.  Did you "connect" your socket to a particular UDP address on the remote?  Or is your socket simply bound and accepting UDP traffic from anyone?

There's not a lot of point calling "shutdown" on a UDP socket.  It MAY allow you to reconnect the socket to another address, but I haven't tried that.  For a TCP socket, "shutdown(fd, SHUT_WR)" is basically sending a TCP FIN packet.  You can still receive data at this point.  Generally, I've seen "shutdown" used for closing TCP connections gracefully:

// send a TCP FIN
shutdown(fd, SHUT_WR);

// now receive until we get a FIN (i.e., "recv" returns zero)
while ( 1 )
{
bytes = recv( fd, buffer, sizeof( buffer ) );
if ( bytes > 0 )
{
// do something with data if you want
}
else if ( bytes == 0 )
{
// other side sent a FIN -- the connection is now closed
}
else
{
if ( errno != EAGAIN )
{
// we got an error on recv -- the connection is probably closed
}
else
{
// need to wait for more data...
exercise_for_reader();
}
}
}

Rob


On Dec 27, 2007, at 7:54 AM, parag vibhute wrote:


In UDP connection at client side, I am not calling connect API so it may happen that shutdown failed as man page tells that shutdown fails if socket is not connected. But am I right? Also then in Tiger & Panther why am I not getting any error & only in Leopard, I am getting the error?

Regards,
Parag Vibhute

On 27-Dec-07, at 3:35 PM, parag vibhute wrote:


Hi,

My application is using UDP BSD  socket for connection. At the end of communication, I am shutting down socket by using SHUTDOWN API & then closing it by using CLOSE API. In Panther & Tiger, it is working fine but in leopard I am getting error that SHUTDOWN is failed, can somebody tell me what is wrong here?

Regards,
Parag Vibhute
echo alclr.qzcefyptyqzepns@nzx | tr a-z@. p-za-o.@


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      email@hidden




--

There are many things in your life that will catch your eye but only a few will catch your heart....pursue those'.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Problem in leopard regarding socket shutdown (From: parag vibhute <email@hidden>)
 >Re: Problem in leopard regarding socket shutdown (From: parag vibhute <email@hidden>)

  • Prev by Date: Re: Problem in leopard regarding socket shutdown
  • Next by Date: Re: Problem in leopard regarding socket shutdown
  • Previous by thread: Re: Problem in leopard regarding socket shutdown
  • Next by thread: Re: Problem in leopard regarding socket shutdown
  • Index(es):
    • Date
    • Thread