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...
Type: Posts; User: trillianjedi
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...
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,...
I'm not sure why you're using CHARS where unsigned INTS and DWORDS would do ?
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).
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,...
Many thanks - all clear now and code working :)
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...
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...
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...
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
...
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...
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...
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...
Ouch ;)
Thank you - great spot.......
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...
Thanks.
Is it considered bad form to just brute force allocate enough memory in the first place (eg, 80 chars) ?
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...
Thanks Elysia. Just trying to get my head around this:-
So, something like:-
char key[20];
char value[20];
.... and called as:-
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;
...
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...
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");...
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...
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...
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).
...
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...