uNetworking / uNetworking/uSockets

udp_benchmark can work on mac os

Open Beginner friendly
#256 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
1.5k
Forks
307
PR merge metrics
No merged PRs in 30d

Description

I am using mac 12.7.6, after make examples, udp_benchmark cant work,
line 143: int sent = us_udp_socket_send(client, send_buf, 40);
return -1, the error code is 'Message is too long'
in bsd.c bsd_sendmmsg() the macro
#if defined(APPLE) seems wrong , i changed to #if 0 and changed line 81 to : #elif defined(_WIN32) || defined(APPLE), it works.
struct us_internal_udp_packet_buffer:
struct us_internal_udp_packet_buffer {
#if defined(_WIN32) || defined(APPLE)
char *buf[LIBUS_UDP_MAX_NUM];
size_t len[LIBUS_UDP_MAX_NUM];
struct sockaddr_storage addr[LIBUS_UDP_MAX_NUM];
#else
struct mmsghdr msgvec[LIBUS_UDP_MAX_NUM];
struct iovec iov[LIBUS_UDP_MAX_NUM];
struct sockaddr_storage addr[LIBUS_UDP_MAX_NUM];
char control[LIBUS_UDP_MAX_NUM][256];
#endif
};
for mac, should not use sendmsg

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in bsd.c, especially bsd_sendmmsg() and the us_internal_udp_packet_buffer definitions, then reproduce the failure with examples/udp_benchmark on macOS. Compare the APPLE and _WIN32 paths and verify that the benchmark sends successfully without the “Message is too long” error.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.