Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8007611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:53:14+00:00 2026-06-04T17:53:14+00:00

I am creating a UDP socket, and attempting to send to an existing server

  • 0

I am creating a UDP socket, and attempting to send to an existing server in the code below:

struct sockaddr_in servAddr;
memset(&servAddr, 0, sizeof(servAddr));  
servAddr.sin_family = AF_INET;              
servAddr.sin_addr.s_addr = inet_addr(SERVER IP ADDRESS GOES HERE);
servAddr.sin_port   = htons(port);

int testSock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);

unsigned char byteData;
int sent;
unsigned int servSize = sizeof(servAddr);

if((sent = sendto(testSock, &byteData, 1, 0, (struct sockaddr *)&servAddr,  (socklen_t)&servSize)) < 0){
    NSLog(@"Error sending to server: %d %d", errno, sent);
}

Every time “sendto” returns -1, and errno is set to 63. I have never encountered this error before.

I can say with complete confidence that there is nothing wrong with the server, or the IP address or port provided. It has to be client-side.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T17:53:16+00:00Added an answer on June 4, 2026 at 5:53 pm

    63 is ‘filename too long’. In this case it is the sockaddr that appears too long to the kernel, and that is because you are passing a pointer as the length, instead of the actual length. The final parameter to sendto() isn’t a pointer, it is a value. Remove the ‘&’.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a UDP Server.I found following code reference from MSDN.Can any one
I am creating a winsock UDP program. code i am using is shown below.
Creating a server-side socket will fail if I'm trying to use the same port
I am creating a UDP socket ( AF_INET , SOCK_DGRAM , IPPROTO_UDP ) via
I am creating a dhcp client in Linux(Ubuntu). I am creating a udp socket
I am creating a UDP socket client in C (unicast) and is wondering why
Creating a searchable contacts kind of app. Below is my code public class EmployeeList
I'm trying to set up a very simple UDP socket server with python that
I'm creating a chat server which accepts both TCP and UDP connections. Assume for
I have been recently writing a UDP server for a 2D shooter game I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.