Home AMX User Forum NetLinx Studio

IP_CLIENT_OPEN gremlins

I've got a strange one I think. Short bit of boiled down code:

DEFINE_DEVICE
dev dvDEV = 0:5:0

DEFINE_CONSTANT
char sDEV_IP_ADDRESS[] = "'192.168.2.210'"
DEV_IP_PORT = 80
DEV_IP_MODE = 1
DEV_MAINLINE_TL = 71

TIMELINE_EVENT[DEV_MAINLINE_TL]
{
IP_CLIENT_OPEN(5,'192.168.2.210',80,1) // this works
// IP_CLIENT_OPEN(dvDEV.PORT,sDEV_IP_ADDRESS,DEV_IP_PORT,DEV_IP_MODE) // this doesn't work
}


I have not been able to figure out what is wrong with my line above that isn't working. Obviously I can work around it, but any ideas out there? Is it something about being inside a timeline_event that the compiler isn't pulling in the right values? Seems like that shouldn't be the problem to me. The fact that I am passing constants into the function? Again, doesn't seem like that shouldn't the problem either. And I'm 100% certain that I've used constants before and they've worked. I also thought maybe it was because I used dvDEV.PORT as one of the parameters. I think in the past I've just created a constant with the port value. But I've seen others use .PORT before. So that shouldn't be the problem. Maybe I'm missing something obvious.

Comments

  • My post is inserting a space in "DEV_IP_P ORT" that I am not typing. I've tried to edit out the space but it will not go away. Anyway, the space is not in the code.
  • a_riot42a_riot42 Posts: 1,624
    Try this perhaps?
    DEFINE_CONSTANT
    char sDEV_IP_ADDRESS[15] = '192.168.2.210'
    long DEV_IP_PORT = 80
    DEV_IP_MODE = 1
    DEV_MAINLINE_TL = 71

    TIMELINE_EVENT[DEV_MAINLINE_TL]
    {
    IP_CLIENT_OPEN(5,'192.168.2.210',80,1) // this works
    // IP_CLIENT_OPEN(dvDEV.PORT,sDEV_IP_ADDRESS,DEV_IP_PORT,DEV_IP_MODE) // this doesn't work
    }
  • viningvining Posts: 4,368
    try it w/o the double quotes on the IP address.

    Actually that's what Paul just posted although I originaly thought he was just trying to get you to encase your code with code tags for the post but he removed the double quotes too.
  • ericmedleyericmedley Posts: 4,177
    Try this instead
    sDEV_IP_ADDRESS[] = '192.168.2.210'

    I'm not at my desk right now to try it myself or I would.
  • HedbergHedberg Posts: 671
    I would make the same suggestion. It's because a string literal with single quotes is a constant and a string expression (double quotes) is not. This is a bug. A constant declaration with an illegal right hand side should not compile.
  • Hedberg wrote: »
    I would make the same suggestion. It's because a string literal with single quotes is a constant and a string expression (double quotes) is not. This is a bug. A constant declaration with an illegal right hand side should not compile.

    I agree with the assessment that this is a compiler bug, and it should not compile. Or it should compile and work.

    char sDEV_IP_ADDRESS[] = '192.168.2.210'

    That fixed it.
Sign In or Register to comment.