• AVR Freaks

Hot!WireShark, UDP, and Hercules weirdness...

Author
gainesy
New Member
  • Total Posts : 8
  • Reward points : 0
  • Joined: 2018/10/09 13:44:35
  • Location: 0
  • Status: offline
2018/11/26 17:27:05 (permalink)
0

WireShark, UDP, and Hercules weirdness...

Hi, 

This is my first time doing this (going to a forum and trying to get a UDP communication setup to work.) I'm getting there but having some weird issues occur.

Goal: Have the Hercules server program that I'm using on my computer talk to my PIC uC. I'm trying to get the PIC to send and recieve messages.
 
What I have: Have a main.c using the microchip library and wrote a UdpServer function with a state machine to try and get the UDP comms to work. The PIC is programmed to send a heartbeat every few seconds and this seems to work. 
 
Issues: Nothing starts sending until WireShark begins capturing data. If I enter a message into Hercules to send to my PIC, this usually works but only about two times and then the PIC stops sending its pre-programmed heartbeat message altogether. I am also trying to write a loop so that I can ensure what I send to the PIC can be read and sent back to the server just to verify that what the PC sends to the PIC (via Hercules) can actually be read and sent back. Maybe this is redundant when I can just check on Wireshark but I was thinking Wireshark was only showing me what is being sent from one destination to another, not if it actually is being accepted by the destination. 

FYIs: For Hercules I am using the UDP tab. I have a specific IP address set up for the PIC and another IP address for the PC. Also, I was very confused about this for a while but I think I have it setup right now: What's the difference between UdpOpen() and UdpOpenEx() ? I ended up using UdpOpenEx(). Let me know if I need to include more details to get my questions answered. 
 
Really appreciate any input!
#1

9 Replies Related Threads

    gainesy
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2018/10/09 13:44:35
    • Location: 0
    • Status: offline
    Re: WireShark, UDP, and Hercules weirdness... 2018/11/27 17:22:56 (permalink)
    0
    Well, I think my code is close (I can't post it which is unfortunate...), but I think my main problem is with trying to use UDPIsGetReady(UdpSocket) function. My UdpSocket is static and it stays at 0x00 when I run through my program. Every time I run it, what seems wrong is that the SocketWithRXData (which is in the UDPIsGetReady function shows a value of 0x00FF which is the default in the UDP.c and UDP.h code which I don't think I'm supposed to change. Am I supposed to declare that somehow? 
     
    After UDPIsGetReady() I am trying to use UDPGet(&byte). I never get here because it is in an if statement that is always false due to this UDPIsGetReady() issue. I hope this is where the problem is but it could be something else of course... 

    Any input is much appreciated. FYI: sending works, receiving is broken and I am using a state machine. Well, to be clear, I can see everything pass on Wireshark but I want to make sure what WireShark shows as being sent to the PIC is actually being received by it. I output a little message once the message is received as a loop so that that can be verified and this is problem - not getting the output but the fact that I fail the UDPIsGetReady function every time makes me think that there is definitely a problem there. Thanks!
    #2
    RISC
    Super Member
    • Total Posts : 5376
    • Reward points : 0
    • Status: offline
    Re: WireShark, UDP, and Hercules weirdness... 2018/12/01 10:26:17 (permalink)
    4 (1)
    Hi,
    Please give details about your hardware : which PIC ?
    About software : which stack ? which version ?
    Regards
     
    #3
    gainesy
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2018/10/09 13:44:35
    • Location: 0
    • Status: offline
    Re: WireShark, UDP, and Hercules weirdness... 2018/12/03 10:19:18 (permalink)
    0
    Hi, thank you for your reply. I'm using a PIC32 and software is the TCP/IP stack. Not sure of the version, where do I find that? It is the Ethernet starter kit (TCPIP ETHSK795).
     
    Edit: I think the version is 5.42
    post edited by gainesy - 2018/12/03 15:18:48
    #4
    gainesy
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2018/10/09 13:44:35
    • Location: 0
    • Status: offline
    Re: WireShark, UDP, and Hercules weirdness... 2018/12/04 14:17:09 (permalink)
    0
    Send and receive problem solved!! :)
     
    BUT...why does my UDP code not start working UNLESS Wireshark is already capturing data? Wireshark MUST be running or else my UDP code does not activate... Any idea why this could be?
    #5
    tpicon
    Senior Member
    • Total Posts : 171
    • Reward points : 0
    • Joined: 2007/07/18 07:59:12
    • Location: Brazil
    • Status: offline
    Re: WireShark, UDP, and Hercules weirdness... 2018/12/12 07:14:51 (permalink)
    0
    you are right, doesn't make sense...
    Did you try write a small program and call Bind to "open" UDP for communication??
    Maybe Hercules isn't doing this
     
    #6
    gainesy
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2018/10/09 13:44:35
    • Location: 0
    • Status: offline
    Re: WireShark, UDP, and Hercules weirdness... 2019/01/04 14:29:22 (permalink)
    0
    Thanks for your response. Looks like Hercules is working because I hardcoded my MAC Address into the microchip Arp.c file so that the MAC address I'm on is recognized and now my project works without running Wireshark. But, now it only works without WireSHark on My computer. Shouldn't there be a way for this to be programmed without a user having to go into Arp.c every time and changing the MAC address? I read that there is an IP Gleaming feature in the TCPIP library so that the IP address can be set (automatically I think?) but it doesn't seem like this automatically sets the MAC address. I want to be able to have the MAC address be recognized no matter where I'm working. I got my project working on my computer without running wireShark but then when I tried running it on my friends computer and I had to run wireshark or go to Arp.c and manually type in the corrent MAC address. Does anyone know if this is possible to fix or does it have to be configured manually everytime you change computers?
     
    Thank you
    #7
    tpicon
    Senior Member
    • Total Posts : 171
    • Reward points : 0
    • Joined: 2007/07/18 07:59:12
    • Location: Brazil
    • Status: offline
    Re: WireShark, UDP, and Hercules weirdness... 2019/02/18 14:20:48 (permalink)
    0
    Hi gainesy, sorry for the delay
    Suggestion: your PC application could send UDP broadcast and in the payload could contain the MAC Address. Then, you PIC firmware can get this and do the stuff you need
     
     
    #8
    Jim Nickerson
    User 452
    • Total Posts : 5962
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: WireShark, UDP, and Hercules weirdness... 2019/02/19 08:43:53 (permalink)
    0
    +1 tpicon, nice idea; advertise your presence.
    Maybe this will give you some ideas https://www.iplocation.net/find-private-network-ip
     
    #9
    crosland
    Super Member
    • Total Posts : 1580
    • Reward points : 0
    • Joined: 2005/05/10 10:55:05
    • Location: Bucks, UK
    • Status: offline
    Re: WireShark, UDP, and Hercules weirdness... 2019/02/20 13:38:00 (permalink)
    4 (1)
    There seems to be some confusion between MAC addresses and IP addresses.
    #10
    Jump to:
    © 2019 APG vNext Commercial Version 4.5