Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apps/examples: Add net local test sample #4171

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

apps/examples: Add net local test sample #4171

wants to merge 1 commit into from

Conversation

junmin-kim
Copy link
Contributor

No description provided.

@seinfra
Copy link

seinfra commented Jan 21, 2020

Target : [c01bebd2abc2604a44df490907dff18c3dc07cf0] - Code Rule Check OK.

@seinfra
Copy link

seinfra commented Jan 21, 2020

Target : [c01bebd2abc2604a44df490907dff18c3dc07cf0] - Code Rule Check (C++) OK.

@seinfra
Copy link

seinfra commented Jan 21, 2020

Target : [5c3408b8e2b5f2edc0a398f4798ba3dc652aa3db] - Code Rule Check OK.

@seinfra
Copy link

seinfra commented Jan 21, 2020

Target : [5c3408b8e2b5f2edc0a398f4798ba3dc652aa3db] - Code Rule Check (C++) OK.

apps/examples/net_local/Make.defs Outdated Show resolved Hide resolved
apps/examples/net_local/net_local_server.c Outdated Show resolved Hide resolved
apps/examples/net_local/net_local_server.c Outdated Show resolved Hide resolved
Comment on lines +47 to +68
strcpy(server_sun.sun_path, server_path);
len = offsetof(struct sockaddr_un, sun_path) + strlen(server_sun.sun_path);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size_t len = strlen(server_sun.sun_path);
strncpy(server_sun.sun_path, server_path, len);

should we use offsetof here?
lwip using whole of structure itself, aligning with lwip will be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't understand this comment. Would you explain more?

apps/examples/net_local/net_local_main.c Outdated Show resolved Hide resolved
write(sockfd, (const void *)str, strlen(str));

n = read(sockfd, buf, MAXLINE);
if (n < 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (n != MAXLINE) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

n is always <= MAXLINE. So n != MAXLINE is not needed

char buf[MAXLINE + 1];
while (1) {
n = read(sockfd, buf, MAXLINE);
if (n < 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above.

apps/examples/net_local/net_local_main.c Outdated Show resolved Hide resolved
apps/examples/net_local/net_local_main.c Outdated Show resolved Hide resolved
apps/examples/net_local/net_local_main.c Outdated Show resolved Hide resolved
@seinfra
Copy link

seinfra commented Jan 29, 2020

Target : [82c864a46b5c67b3a2bd0c50c64b796f1a555a2b] - Code Rule Check OK.

@seinfra
Copy link

seinfra commented Jan 29, 2020

Target : [82c864a46b5c67b3a2bd0c50c64b796f1a555a2b] - Code Rule Check (C++) OK.

@seinfra
Copy link

seinfra commented Jan 29, 2020

Target : [63c3837594030714c3f87eb74f7e581266bf7a32] - Code Rule Check OK.

@seinfra
Copy link

seinfra commented Jan 29, 2020

Target : [63c3837594030714c3f87eb74f7e581266bf7a32] - Code Rule Check (C++) OK.

apps/examples/net_local/Makefile Outdated Show resolved Hide resolved
apps/examples/net_local/net_local.h Outdated Show resolved Hide resolved
apps/examples/net_local/net_local_main.c Outdated Show resolved Hide resolved
apps/examples/net_local/net_local_server.c Outdated Show resolved Hide resolved
apps/examples/net_local/net_local_server.c Outdated Show resolved Hide resolved
apps/examples/net_local/net_local_main.c Outdated Show resolved Hide resolved
@seinfra
Copy link

seinfra commented Jan 29, 2020

Target : [d848d4ae084773a8f966723309bb1c6adec1284a] - Code Rule Check OK.

@seinfra
Copy link

seinfra commented Jan 29, 2020

Target : [d848d4ae084773a8f966723309bb1c6adec1284a] - Code Rule Check (C++) OK.

@seinfra
Copy link

seinfra commented Jan 29, 2020

Target : [d0eac22a4e89f76749cfbea7e36f145e782eef5e] - Code Rule Check (C++) OK.

@seinfra
Copy link

seinfra commented Jan 29, 2020

Target : [d0eac22a4e89f76749cfbea7e36f145e782eef5e] - Code Rule Check OK.

@seinfra
Copy link

seinfra commented Jan 29, 2020

Target : [9a88da1675bc2c871bce63a75e530809a849ddff] - Code Rule Check (C++) OK.

@seinfra
Copy link

seinfra commented Jan 29, 2020

Target : [9a88da1675bc2c871bce63a75e530809a849ddff] - Code Rule Check OK.

@seinfra
Copy link

seinfra commented Jan 29, 2020

Target : [3f55373] - Code Rule Check (C++) OK.

@seinfra
Copy link

seinfra commented Jan 29, 2020

Target : [3f55373] - Code Rule Check OK.

Copy link
Member

@gcjjyy gcjjyy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good, Please consider TJ's comment


#include "net_local.h"

int client_talk(int sockfd, const char *func, const char *str)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it local function?

jsdosa
jsdosa previously approved these changes Mar 19, 2020
Copy link
Contributor

@jsdosa jsdosa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good.

Copy link

@tools3210 tools3210 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks good to me.

@tizen-build
Copy link

Target : [3f55373] - Code Rule Check OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants