udp socket 
Author Message
 udp socket

Hi,

I have to code a tftp server (something like ftp but over UDP).
I've got problem with the manage of socket.
I've read the code of the package avaible on my Debian but all of them
use it with inetd and so don't define the port.

This is my code:

-----
int main ()
{
  int server_sockfd;
  int server_len;
  struct sockaddr_in sin;
  struct sockaddr_in from;
  fd_set fd;
  char data[512];
  char file[256];
  int from_len;

  // def de l'adresse
  sin.sin_family = AF_INET;
  sin.sin_addr.s_addr = htonl (INADDR_ANY);
  sin.sin_port = htons (6666);

  from.sin_family = AF_INET;

  server_sockfd = socket (AF_INET, SOCK_DGRAM, 0);
  perror("socket");

  // on lie au port 6666
  bind (server_sockfd, (struct sockaddr *) &sin,
        sizeof (sin));
  perror("bind");
  connect(server_sockfd, (struct sockaddr *) &from,
        sizeof (from));
  perror("connect");

------

and I've got this output (generate by the perror):
socket: Success
bind: Illegal seek
connect: Illegal seek

What is the problem ?

Thanx



Thu, 22 Apr 2004 09:17:03 GMT  
 udp socket

Quote:
> Hi,

> I have to code a tftp server (something like ftp but over UDP).
> I've got problem with the manage of socket.
> I've read the code of the package avaible on my Debian but all of them
> use it with inetd and so don't define the port.

> This is my code:

<off-topic code sniped>

Quote:
> ------

> and I've got this output (generate by the perror):
> socket: Success
> bind: Illegal seek
> connect: Illegal seek

> What is the problem ?


Mark Duell



Thu, 22 Apr 2004 16:24:39 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Close a UDP socket

2. Q: Writing UDP Socket in C...

3. UDP Socket question

4. TCP/UDP sockets in Visual C++.

5. Broadcast over UDP socket

6. UDP socket and InstallShield???

7. Multihreading UDP Socket Server

8. UDP sockets - How to read data?

9. UDP Socket Win32 Help

10. UDP sockets samples?

11. UDP Socket question

12. UDP Socket

 

 
Powered by phpBB® Forum Software