microsoft / microsoft/ntttcp-for-linux

Question Related to the Code

Open
#39 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
426
Forks
108
PR merge metrics
No merged PRs in 30d

Description

I've been studying this code for a few days to learn more about network programming. I've learned some good things, Thanks!

My question is
I've seen this use of memset in other code and sample, but I'm curious as to why cast the struct to (char *)
instead of just memset(&serv_addr, 0, sa_size)

https://github.com/microsoft/ntttcp-for-linux/blob/14705f17876d4237db324944c37a650d6f03506d/src/udpstream.c#L44

Thanks in advance,

  • Roberto

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 at src/udpstream.c around line 44 and inspect the memset call involving serv_addr and sa_size. Read the relevant C memset declaration and surrounding code to determine what explanation is needed; done means providing a clear answer to why the cast is used, rather than changing the benchmark.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.