OK, thanks Erel, I'll remember that, but I am certain I didn't have another usocket variable in the other module and it compiled ok. Also I'm certain that having the same Process global declared in 2 modules doesn't cause an error but I think it should at least give a warning because it is likely to be a mistake.
Even so, after I added "Main." before every usocket in the other module I still had a problem.
In the Main module the usocket is declared and in Activity_Create it is initialized to give the interrupt handler and the port. I used 0 for the port here.
usocket.initialize("usocket",0,100)'there is Sub usocket_PacketArrived in this module
In the my Terminal module I first found that I couldn't handle received udp packets, then I did this in ACtivity create
Main.usocket.initialize("usocket2", Main.usocket.port,100) 'because I want the same port throughout the process. There is Sub usocket2_PacketArrived in this module
That worked, and I could send and receive packets in the Main activity and then go to the terminal activity and keep using the same port. But when I go back to the first activity again nothing I could come up with would work and all the packets received were queued up until I went back to the terminal activity. Can interrupts for an activity work when another is running? Well stupid question I suppose because apparently they can.
Eventually I gave up and had 2 separate UDP sockets and that let my app work but now the server has to reply to 2 different ports. That's not a problem but my lack of understanding of this is (to me).
Can you suggest a solution? Is having a global object is a problem when it comes to dealing with interrupts?