Search:

Type: Posts; User: trillianjedi

Page 1 of 2 1 2

Search: Search took 0.00 seconds.

  1. Sure, here's the code. The idea is a client...

    Sure, here's the code.

    The idea is a client connects via TCP, on port 8585, and sends up to 4 ports on which it wishes to receive UDP packets. The server collects these 4 ports, and then sends...
  2. Can I bind a UDP socket to a port, but send to any other port?

    Hi there,

    I'm working on an application that needs to send out UDP packets to arbitrary ports (could be sending to anything from Port 1024 and up).

    Due to firewall configuration on the server,...
  3. Replies
    27
    Views
    6,629

    I'm not sure why you're using CHARS where...

    I'm not sure why you're using CHARS where unsigned INTS and DWORDS would do ?
  4. Replies
    5
    Views
    2,622

    I would put the fclose inside your ( != NULL)...

    I would put the fclose inside your ( != NULL) conditional also, otherwise your application may end up tryng to close a NULL pointer (which several OS's don't like you doing).
  5. Replies
    12
    Views
    6,269

    Int return from functions - 0 or 1 ?

    Most of the standard C system calls I use return 0 on success, -1 on failure and sometimes an arbitrary positive int as information to the caller.

    This means comparing to -1 to check on success,...
  6. Many thanks - all clear now and code working :)

    Many thanks - all clear now and code working :)
  7. Aha! Lightbulb moment..... Thanks - you've...

    Aha! Lightbulb moment.....

    Thanks - you've clarified that for me greatly.

    So the next natural question is have I done this the right way? So I have an anonymous structure which is typedef'd to...
  8. OK - my intention is that this is a structure...

    OK - my intention is that this is a structure which is known as a "configurationOptions" structure. Is my typedef somehow inccorect?

    Thanks again for you help.


    typedef struct {
    char...
  9. OK - many thanks. The code now compiles, so...

    OK - many thanks. The code now compiles, so that's fab and I'm grateful for your help.

    However, I'm left slightly confused as to why my structure is "anonymous"? My understanding (which appears...
  10. Thanks - I understand now. So the "->" actually...

    Thanks - I understand now. So the "->" actually de-references....

    I'm now getting different compiler errors :-


    includes/configuration.h:67: error: dereferencing pointer to incomplete type

    ...
  11. Many thanks - that looks like it will correct my...

    Many thanks - that looks like it will correct my original code.

    How do I do the sizeof though, if suppliedStructure->host is actually a pointer to something (in which case will sizeof not...
  12. Problem referencing structure elements by pointer

    Hi folks,

    I feel a little guilt coming here and only asking questions - hard for me to contribute to the community here much at the moment as I'm on a steep learning curve. A big thanks for all of...
  13. Replies
    3
    Views
    2,565

    C Code Review

    This is a fairly generic question and there is no specific job at the moment (although will be in a week or two). I wondered if there are experienced C developers here who would be able to do a code...
  14. Replies
    3
    Views
    4,110

    Ouch ;) Thank you - great spot.......

    Ouch ;)

    Thank you - great spot.......
  15. Replies
    3
    Views
    4,110

    Incompatible Pointer Type warnings

    Hi all,

    I'm using a piece of code from a book (Linux Programming) which includes some IPC related excerpts I'd like to use (queue stuff).

    Here's some code that I'm using from the book, which...
  16. Replies
    17
    Views
    2,464

    Thanks. Is it considered bad form to just...

    Thanks.

    Is it considered bad form to just brute force allocate enough memory in the first place (eg, 80 chars) ?
  17. Replies
    17
    Views
    2,464

    Many thanks - all working now. Right. So I...

    Many thanks - all working now.



    Right. So I would look at the strlen of value and see if there's enough room in the buffer (plus 1 for the null terminator) before copying.

    If buffer isn't...
  18. Replies
    17
    Views
    2,464

    Thanks Elysia. Just trying to get my head around...

    Thanks Elysia. Just trying to get my head around this:-



    So, something like:-

    char key[20];
    char value[20];

    .... and called as:-
  19. Replies
    17
    Views
    2,464

    Ah, you might have just put me on the right track...

    Ah, you might have just put me on the right track with your question. My test calling app looks like this (header includes removed for brevity):-


    int main(void)
    {

    char * s;
    size_t i;

    ...
  20. Replies
    17
    Views
    2,464

    Thanks Salem/Elysia - sorry, I was being slow...

    Thanks Salem/Elysia - sorry, I was being slow earlier (late night ;) ).

    Now I have:-


    int getStringFromConf(const char * searchkey, char *resultValue, size_t resultSize) {
    int result...
  21. Replies
    17
    Views
    2,464

    Yup, as mentioned I haven't got that far. So...

    Yup, as mentioned I haven't got that far. So taking the above into account:-


    char * getStringFromConf(const char * searchkey) {
    char c[120];
    FILE *f;
    f = fopen(CONF_FILE_PATH, "r");...
  22. Replies
    17
    Views
    2,464

    Stuck halfway through a function

    Hi all,

    I'm trying to create a function that finds a key=value pair in a file and returns the value part for the given key. EG, if test.conf contains the text "port=10", I need a function to which...
  23. Replies
    4
    Views
    1,870

    Oh, I'm going back to the 1970's ;) Of course...

    Oh, I'm going back to the 1970's ;) Of course memory usage was far more significant than it is now. If you could do something in a byte, you did it in a byte, not 4.

    Excellent suggestion though...
  24. Replies
    4
    Views
    1,870

    That doesn't seem to have the required effect. ...

    That doesn't seem to have the required effect.

    Also on further reading I've found that it is advised not to mess with ENUM sizes unless you're changing them globally (which I don't want to do).
    ...
  25. Replies
    4
    Views
    1,870

    typedef'd enum specifying type

    Hi all,

    I'm having trouble setting the size of an enumerated type when it's set as a typedef:-


    typedef enum
    { MT_NULL, MT_ACK, MT_PING, MT_BYE, MT_GETINFO }
    messageType;

    The above is...
Results 1 to 25 of 28
Page 1 of 2 1 2