c - TFTP Client (based on ENET) won't connect to remote TFTP server -


i'm trying implement tftp client in c (windows, visual studio 2005).

the tftp client supposed connect remote tftp server address on port 69.

the tftp client using enet api networking stuff, can't work.

the tftp client never switches 'connected' state , stuck in 'connecting' state.

when run native windows tftp client on windows 7 (cmd, windows console), has no problem connecting tftp server , can retrieve remote file without problems.

so must doing wrong in code below , i'm hoping out there can tell me i'm doing wrong:

#include "enet.h" #include <stdlib.h> #include <stdio.h>  #pragma comment(lib, "winmm.lib") #pragma comment(lib, "ws2_32.lib")  void main(void) {     enetaddress address;     enetevent thisevent;     enetpeer *peer;     enethost* client;     int rc;      memset(&thisevent,0,sizeof(enetevent));      rc = enet_initialize ();      /* create tftp client */     client = enet_host_create(null, 1,1,0,0);      /* address , port of remote tftp server */     rc = enet_address_set_host (& address, "192.168.30.50");     address.port = 69;      /* connect client server */     peer = enet_host_connect (client, & address, 1, 0);          while (1)     {         printf("state = %d | event type = %d\n", peer->state, thisevent.type);         enet_host_service (client, &thisevent, 1000);     } } 

from documentation doesn't "enet" library plain udp communications. rather, implements "single, uniform protocol layered on udp". not tftp protocol, client not compatible standard tftp server.

use plain sockets instead.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -