Hello,

The difference between

Incoming message of size 199 bytes from [196.24.225.38]:56789

and

Resource /a/light hosted at endpoints:
[49.57.54.46]:56789

is that the former is the source address of the incoming UDP packet containing 
the /oic/res (discovery) response, and
the latter is the address stored in the /oic/res response for the /a/light 
resource. Client requests to resources
are always directed to addresses listed against said resources in the discovery 
response from a Server.
That is the OCF specified model of Client<->Server interaction.

The list of endpoints to return in /oic/res responses is compiled by an 
implementation of the
oc_endpoint_t * oc_connectivity_get_endpoints(size_t device)
interface which is (up to you but) usually implemented inside the ipadapter.

You've probably written an ipadapter for the arduino mega and implemented this 
interface there. That would be
the first place to check how you're retrieving the system's IP address(es) and 
storing them into oc_endpoint_t structures
as those are serialized to strings and echoed back as-is in every /oic/res 
response.

> I would like to share my development setup with the
> community, i wonder if a branch can be allocated to this
> port

We don't need a branch. Once you've completed the work and have it working you 
may submit it to the master branch
where it'll be reviewed and eventually accepted into the project.

Thanks very much for your efforts!

-Kishen.


--
Kishen Maloor
Intel Open Source Technology Center

From: <iotivity-dev@lists.iotivity.org> on behalf of yondaime Hokage 
<mandza....@gmail.com>
Date: Tuesday, January 8, 2019 at 12:16 AM
To: "iotivity-dev@lists.iotivity.org" <iotivity-dev@lists.iotivity.org>
Subject: [dev] Iotivity constrained IPV4 address issue


Hello there!

I am experiencing with iotivity constrained on avr device(arduino mega)!

i could port iotivity to it! but am facing an issue when deploying arduino as a 
server?

can you guys take a look at this logs:

`Incoming message of size 199 bytes from [196.24.225.38]:56789

DEBUG: ../../api/oc_buffer.c <process_thread_message_buffer_handler:158>: 
Inbound network event: decrypted request
DEBUG: ../../messaging/coap/engine.c <coap_receive:124>: CoAP Engine: received 
datalen=199 from
DEBUG: ../../messaging/coap/engine.c <coap_receive:125>: [196.24.225.38]:56789
DEBUG: ../../messaging/coap/engine.c <coap_receive:126>: 58 45 C6 09 DC 36 B4 
05 FC 4E BC A8 C2 27 10 E2 06 EC 08 00 FF 9F BF 66 61 6E 63 68 6F 72 78 2A 6F 
63 66 3A 2F 2F 66 65 35 35 30 30 30 30 2D 30 39 35 64 2D 34 30 30 30 2D 34 66 
30 34 2D 30 30 30 30 35 31 33 33 30 30 30 30 64 68 72 65 66 68 2F 61 2F 6C 69 
67 68 74 62 72 74 9F 6A 63 6F 72 65 2E 6C 69 67 68 74 70 63 6F 72 65 2E 62 72 
69 67 68 74 6C 69 67 68 74 FF 62 69 66 9F 69 6F 69 63 2E 69 66 2E 72 77 6F 6F 
69 63 2E 69 66 2E 62 61 73 65 6C 69 6E 65 FF 61 70 BF 62 62 6D 03 FF 63 65 70 
73 9F BF 62 65 70 78 18 63 6F 61 70 3A 2F 2F 34 39 2E 35 37 2E 35 34 2E 34 36 
3A 35 36 37 38 39 FF FF FF FF
DEBUG: ../../messaging/coap/coap.c <coap_parse_token_option:448>: Token (len 8)
DEBUG: ../../messaging/coap/coap.c <coap_parse_token_option:449>: DC 36 B4 05 
FC 4E BC A8
DEBUG: ../../messaging/coap/coap.c <coap_parse_token_option:506>: OPTION 12 
(delta 12, len 2):
DEBUG: ../../messaging/coap/coap.c <coap_parse_token_option:518>: 
Content-Format [10000]
DEBUG: ../../messaging/coap/coap.c <coap_parse_token_option:667>: 
Content-format/accept-Version: [2048]
DEBUG: ../../messaging/coap/coap.c <coap_parse_token_option:683>: -Done 
parsing-------
DEBUG: ../../messaging/coap/engine.c <coap_receive:162>: Parsed: CoAP version: 
1, token: 0xDC36, mid: 50697
DEBUG: ../../messaging/coap/engine.c <coap_receive:168>: type: NON
DEBUG: ../../messaging/coap/engine.c <coap_receive:567>: created new response 
buffer for uri oic/res
DEBUG: ../../messaging/coap/engine.c <coap_receive:577>: got response buffer 
for uri oic/res
DEBUG: ../../messaging/coap/engine.c <coap_receive:591>: processing incoming 
block
DEBUG: ../../messaging/coap/engine.c <coap_receive:616>: calling 
oc_ri_invoke_client_cb
Resource /a/light hosted at endpoints:
[49.57.54.46]:56789
DEBUG: ../../messaging/coap/transactions.c <coap_new_transaction:89>: Created 
new transaction 17773: 0x18ee190
DEBUG: ../../messaging/coap/coap.c <coap_serialize_options:344>: Caculating 
size of options
DEBUG: ../../messaging/coap/coap.c <coap_serialize_message:921>: -Serializing 
MID 17773 to 0x18ecf40
DEBUG: ../../messaging/coap/coap.c <coap_serialize_message:931>: Token (len 8)
DEBUG: ../../messaging/coap/coap.c <coap_serialize_message:932>: 01 8B 0D 90 68 
B3 CB 0C
DEBUG: ../../messaging/coap/coap.c <coap_serialize_options:342>: Serializing 
options at 0x18ecf4c
DEBUG: ../../messaging/coap/coap.c <coap_serialize_array_option:213>: ARRAY 
type 11, len 7, full [a/light]
DEBUG: ../../messaging/coap/coap.c <coap_serialize_array_option:224>: STEP 0/7 
(a)
DEBUG: ../../messaging/coap/coap.c <coap_serialize_array_option:224>: STEP 1/7 
(/)
DEBUG: ../../messaging/coap/coap.c <coap_set_option_header:147>: WRITTEN 1 B 
opt header
DEBUG: ../../messaging/coap/coap.c <coap_serialize_array_option:245>: OPTION 
type 11, delta 11, len 2, part [a]
DEBUG: ../../messaging/coap/coap.c <coap_serialize_array_option:224>: STEP 3/7 
(i)
DEBUG: ../../messaging/coap/coap.c <coap_serialize_array_option:224>: STEP 4/7 
(g)
DEBUG: ../../messaging/coap/coap.c <coap_serialize_array_option:224>: STEP 5/7 
(h)
DEBUG: ../../messaging/coap/coap.c <coap_serialize_array_option:224>: STEP 6/7 
(t)
DEBUG: ../../messaging/coap/coap.c <coap_serialize_array_option:224>: STEP 7/7 
()
DEBUG: ../../messaging/coap/coap.c <coap_set_option_header:147>: WRITTEN 1 B 
opt header
DEBUG: ../../messaging/coap/coap.c <coap_serialize_array_option:245>: OPTION 
type 11, delta 0, len 8, part [light]
DEBUG: ../../messaging/coap/coap.c <coap_serialize_options:364>: Uri-Path 
[a/light]
DEBUG: ../../messaging/coap/coap.c <coap_serialize_options:366>: Serialize 
content format: 10000
DEBUG: ../../messaging/coap/coap.c <coap_serialize_int_option:172>: OPTION 12 
(delta 1, len 2)
DEBUG: ../../messaging/coap/coap.c <coap_set_option_header:147>: WRITTEN 1 B 
opt header
DEBUG: ../../messaging/coap/coap.c <coap_serialize_options:369>: Content-Format 
[10000]
DEBUG: ../../messaging/coap/coap.c <coap_serialize_int_option:172>: OPTION 17 
(delta 5, len 2)
DEBUG: ../../messaging/coap/coap.c <coap_set_option_header:147>: WRITTEN 1 B 
opt header
DEBUG: ../../messaging/coap/coap.c <coap_serialize_options:374>: Accept [10000]
DEBUG: ../../messaging/coap/coap.c <coap_serialize_int_option:172>: OPTION 2049 
(delta 2032, len 2)
DEBUG: ../../messaging/coap/coap.c <coap_set_option_header:147>: WRITTEN 3 B 
opt header
DEBUG: ../../messaging/coap/coap.c <coap_serialize_int_option:172>: OPTION 2053 
(delta 4, len 2)
DEBUG: ../../messaging/coap/coap.c <coap_set_option_header:147>: WRITTEN 1 B 
opt header
DEBUG: ../../messaging/coap/coap.c <coap_serialize_options:435>: -Done 
serializing at 0x18ecf62----
DEBUG: ../../messaging/coap/coap.c <coap_serialize_message:960>: -Done 34 B 
(header len 34, payload len 0)-
DEBUG: ../../messaging/coap/coap.c <coap_serialize_message:962>: Dump
DEBUG: ../../messaging/coap/coap.c <coap_serialize_message:963>: 58 01 45 6D 01 
8B 0D 90
DEBUG: ../../messaging/coap/transactions.c <coap_send_transaction:116>: Sending 
transaction(len: 34) 17773: 0x18ee190
DEBUG: ../../messaging/coap/transactions.c <coap_send_transaction:117>: 58 01 
45 6D 01 8B 0D 90 68 B3 CB 0C B1 61 05 6C 69 67 68 74 12 27 10 52 27 10 E2 06 
E3 08 00 42 08 00
DEBUG: ../../messaging/coap/coap.c <coap_send_message:975>: -sending OCF 
message (34)-
DEBUG: ../../messaging/coap/transactions.c <coap_clear_transaction:194>: 
Freeing transaction 17773: 0x18ee190
DEBUG: ../../api/oc_buffer.c <process_thread_message_buffer_handler:193>: 
Outbound network event: unicast message
Outgoing message of size 34 bytes to [49.57.54.46]:56789

DEBUG: ipadapter.c <send_msg:1026>: Sent 34 bytes
`
this is  part of what i am getting running the linux simpleclient:

now,  here is the problem, my arduino server is running at unicast IP: 
196.X.X.X at port 56789
this what the ipadapter part of the linux port return as expected.

but when the iotivity stack build the discovery response somehow the ip address 
becomes this
calling oc_ri_invoke_client_cb Resource /a/light hosted at endpoints: 
[49.57.54.46]:56789
why would it change the ip to this value( also where is this coming from?).

i could tell that this was the reason i got nothing from the server.

so i forcefully went into the simpleclient.c code and force it to use the 
arduino server IP in the discovery response and it proceeded as expected?

can one provide some help in this regard

I would like to share my development setup with the community, i wonder if a 
branch can be allocated to this port


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#10137): 
https://lists.iotivity.org/g/iotivity-dev/message/10137
Mute This Topic: https://lists.iotivity.org/mt/28971804/21656
Group Owner: iotivity-dev+ow...@lists.iotivity.org
Unsubscribe: https://lists.iotivity.org/g/iotivity-dev/unsub  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to