NetProg

 


   

NETPROG  PRESENTATION

 

  OverView
  Functionalities
  Programming
API
C Examples
  Download
DNS example
C NetProg Programming
IP client server Connection Dialog Examples
TCP yes yes IP_PROTO_TCP TCP example
FTP yes no IP_PROTO_FTP FTP example
HTTP yes no IP_PROTO_HTTP HTTP example
SMTP yes no IP_PROTO_SMTP SMTP example
POP yes no IP_PROTO_POP POP example
DNS yes no IP_PROTO_DNS DNS example
DG yes yes IP_PROTO_DG USER_DEFINED example
IO          
STORE yes - IO_PROTO_STORE ANY  example
FIXED SIZE yes - IO_PROTO_FIOP  USER_DEFINED example
DATABASE          
ODBC yes - DB_PROTO_ODBC  DB example
ORACLE yes  -  DB_PROTO_ORACLE  DB example 
SQL/DS      DB_PROTO_SQLDS  DB example 

 

  

#include "mx.h" 
#include "dns.h"

 

int Reply (MXMessage* pmessage, MXCom* pcom, void* apfield)
{
   int i;
   STRING Domain = (STRING)MXGetValue (pmessage, "Domain", 1);
   WORD Class = (WORD) MXGetValue (pmessage, "QClass", 1); 
   WORD ACount = (WORD) MXGetValue (pmessage, "AnswerCount", 1); 
   WORD RCount = (WORD) MXGetValue (pmessage, "AuthorityCount", 1); 
   WORD PCount = (WORD) MXGetValue (pmessage, "AdditionalCount", 1); 
   WORD Code = (WORD) MXGetValue (pmessage, "Code", 1); 

   for (i = 1; i <= ACount + PCount + RCount; i++)
   {
      WORD Section = (WORD) MXGetValue (pmessage, "Section", i); 
      WORD Type = (WORD) MXGetValue (pmessage, "Type", i); 
      STRING Value = (STRING)MXGetValue (pmessage, "Value", i);
      STRING Name = (STRING)MXGetValue (pmessage, "Name", i);
      printf ("%d %d %30s %5s %s\n", Section, i, Name, DNSGetNameFromType (Type), Value);
   }
   return 1;
}



void main ()

{

   MX mx;
   MXMessage* pmessage;

   LONG Identity = 1000;
   WORD Operation = QUERY;
   WORD Type = T_MX;
   WORD Class = C_IN;
   BUFFERPARM Record;
   Record.BufferSize = 0;
   Record.BufferContent = NULL;

 

   MXInit (&mx, MXSERVER, NULL, NULL, 0, NULL);

/* Establish Connection with DNS Server */

   DNSCom = MXOpenTCP (&mx, "dnsint.chronopost.fr", 53, IPPROTO_DNS, NULL, NULL,   TRUE);
   MXAddComCallBack (&mx, DNSCom, DNS_SYS, "Reply", MXONRECV, Reply, NULL);

   pmessage = MXPutMessage (DNSCom, DNS_SYS, "Query");
   MXSetValue (pmessage, "Identity",   1, &Identity);
   MXSetValue (pmessage, "QClass",     1, &Class);
   MXSetValue (pmessage, "QType",      1, &Type);
   MXSetValue (pmessage, "Domain",     1, "chronopost.fr");
   MXSetValue (pmessage, "Operation",  1, &Operation);
   MXSetValue (pmessage, "RecordData", 1, &Record);

 

 

   MXDispatchEvents (&mx, 0);
   MXEnd (&mx);

}