Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. problem with sending packet from client to server

problem with sending packet from client to server

Scheduled Pinned Locked Moved C / C++ / MFC
helpsysadmin
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    chirag_chauhan
    wrote on last edited by
    #1

    Hi, when i m trying to transfer the encoded packet after escape encoding it from client to server using foloowing code snippet....... AES_EncodeForService(data,key,&res,&len); // disard & strcpy(tempstr,""); j=0; for (i=12;i%s",tempstr); // construct a packet with header followed by footer........ strcpy(packet,header); strcat(packet,withCode); // set buffer len=strlen(packet); sprintf(sendbuf,"POST /services/ws.asp HTTP/1.0\r\nContent-type: application/x-www-form-urlencoded\r\nContent-length: %d\r\n%s\r\n\r\n",len,packet); // length of buffer len=strlen(sendbuf); // send packet.............. bytesSent = send(ConnectSocket,sendbuf,len,0); printf("\nBytes Sent: %ld\n\n", bytesSent ); /// receive packet.......... bytesRecv = recv(ConnectSocket,recvbuf,10000,0); // if doesn't receive the bytes..... if (bytesRecv <= 0) printf("\n Error : %d",WSAGetLastError()); // display the received content......... else { printf("\n Receive buffer : %s\n\n",recvbuf); AES_Decode(recvbuf,key,&recvData,&len); printf("\n Decode : %s \n\n",recvData); } my problem is that the characters which r not aphanumeric get changed and hence does not able to decode it properly. chirag_a_chauahn

    V 1 Reply Last reply
    0
    • C chirag_chauhan

      Hi, when i m trying to transfer the encoded packet after escape encoding it from client to server using foloowing code snippet....... AES_EncodeForService(data,key,&res,&len); // disard & strcpy(tempstr,""); j=0; for (i=12;i%s",tempstr); // construct a packet with header followed by footer........ strcpy(packet,header); strcat(packet,withCode); // set buffer len=strlen(packet); sprintf(sendbuf,"POST /services/ws.asp HTTP/1.0\r\nContent-type: application/x-www-form-urlencoded\r\nContent-length: %d\r\n%s\r\n\r\n",len,packet); // length of buffer len=strlen(sendbuf); // send packet.............. bytesSent = send(ConnectSocket,sendbuf,len,0); printf("\nBytes Sent: %ld\n\n", bytesSent ); /// receive packet.......... bytesRecv = recv(ConnectSocket,recvbuf,10000,0); // if doesn't receive the bytes..... if (bytesRecv <= 0) printf("\n Error : %d",WSAGetLastError()); // display the received content......... else { printf("\n Receive buffer : %s\n\n",recvbuf); AES_Decode(recvbuf,key,&recvData,&len); printf("\n Decode : %s \n\n",recvData); } my problem is that the characters which r not aphanumeric get changed and hence does not able to decode it properly. chirag_a_chauahn

      V Offline
      V Offline
      valikac
      wrote on last edited by
      #2

      So what is the problem? Is it the encryption or the data transfer? Kuphryn

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups