|
Here[^] you can find a tool (and source code) which retrieves information about each connection
|
|
|
|
|
Nope. I've downloaded both the source of netstatp and TcpView utility from a recommended site. There's no information there how to find out a service the client is using. Even a TcpView only guesses the service from a well known port number.
Regards,
Zdenek
|
|
|
|
|
You cannot guess!
The only way would be to create a filter to listen to the connection and to check the service that way. But normally it is not possible!
Don't try it, just do it!
|
|
|
|
|
You're question doesn't make sense.
Both the client and service code must 'speak' the same service protocol (e.g. telnet).
Well know port numbers are associated with specific services so that it is easier to write client code (you only need the server name and can assume the expected service is listening on the appropriate port).
If you configure your service to listen to another port instead of, or as well as, the well known port number then you know that any client that connects to that port MUST speak that protocol if any meaningfull communication is to take place.
e.g.
If you have a ftp server that you set up to listen to port 2000 and have a telnet client try to connect to port 2000 nothing will happen - they speak different protocols.
In short, the server dictates the protocol the client must use.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
How to read barcode data from VC
thanks in advance
|
|
|
|
|
Krishna Kumar N wrote:
How to read barcode data from VC
Just like you would any other type of data, I presume. Once you know the format, the actual reading of the data is fairly easy.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
|
I have followed the below article but I am still facing a problem. I get this compile error msg ( e:\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(9679): error C2872: 'IXMLDOMDocument' : ambiguous symbol ) in a file which is located in VS.NET Folder. I cant modify it ... so what to do ? ... Some body any help
http://support.microsoft.com/default.aspx?scid=kb;en-us;316317
Best Regards,
|
|
|
|
|
Hello
I had the same situation. There is a function conflict and compiler doesn’t know which function to use, that, which is defined in header files, or that, which you were imported.
You can import MSXML something like this:
#import <msxml3.dll> raw_interfaces_only, rename_namespace("MSXML")
And then, you will access it in the way:
MSXML::IXMLDOMDocument
With best regards,
Andrew
|
|
|
|
|
hi all,
Right click on "desktop".Select "properties".In that select "settings".
In that select "advanced".In that select "troubleshooting".In that there is a slider bar which contains "Hardware Acceleration".
Kindly let me know how can i check status of this "hardware acceleration" through program.
Thanks and regards,
ashwath
|
|
|
|
|
ashwath2005 wrote:
Kindly let me know how can i check status of this "hardware acceleration" through program.
See here.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
respected sir,
we r doning on one project.and in that project we want to transferred one file from one pc to another
pc.using network API functions in vc++.we r not able understand our problem.when we run our clinet and server program in
single pc there r no problem in program execution.but when we run same program in two different pc that time it will work
for first time and second time it will send zero byte.and when we debug that program it wll work perfactly ,there r no
problem.our program is simple console base in vc++.we r using packets for sending file data.can we send whole file at a time
togather?.
i m sending my client n server code along this mail.plz go through that code.n send me the solution of
that problen.plz try to understand our problem.is there any problem in socket connection.we r using TCP/IP protocol.
//our server code r.........................
// server.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <string.h>
#include <afxsock.h>
#include <stdio.h>
#include <sys stat.h="">
#include <sys types.h="">
struct dispstruct
{
unsigned int x;
unsigned int y;
unsigned int z;
};
typedef struct dispstruct dispstruct;
dispstruct data;
int main(int argc, char* argv[])
{
FILE *fp,*fp1;
char filename[256];
char cData[1024];
struct _stat st;
SOCKET serversockhandle;
SOCKET acceptsock;
SOCKADDR_IN serveraddr;
SOCKADDR_IN cliaddr;
WORD wVersionRequested;
WSADATA wsaData;
int err;
unsigned id=0;
unsigned short port = 1500;
long filesize,quotient,remainder,length=1;
wVersionRequested=MAKEWORD(2,2);
err=WSAStartup(wVersionRequested,&wsaData);
if(err!=0)
{
printf("\n Error in Socket . \n");
return false;
}
serversockhandle=socket(AF_INET,SOCK_STREAM,0);
if(serversockhandle<0)
{
printf("\nError in creating socket\n");
return 0;
}
memset(&serveraddr,0,sizeof(serveraddr));
serveraddr.sin_family=AF_INET;
serveraddr.sin_addr.s_addr=htonl(INADDR_ANY);
serveraddr.sin_port=htons(port);
printf("\n BINDING................\n");
if((bind(serversockhandle,(LPSOCKADDR)&serveraddr,sizeof(sockaddr)))<0)
{
closesocket(serversockhandle);
printf("\nError in Binding ...........\n");
return false;
}
printf("\n LISTENING................\n");
int retvalue=listen(serversockhandle,20);
if(retvalue<0 || retvalue==SOCKET_ERROR)
{
closesocket(serversockhandle);
printf("\nError in Listening ...........\n");
return false;
}
while(1)
{
int addrlen=sizeof(cliaddr);
acceptsock=accept(serversockhandle,(LPSOCKADDR)&cliaddr,&addrlen);
printf("\n Connecting fron %s by port no: %d \n",inet_ntoa(cliaddr.sin_addr),ntohs(cliaddr.sin_port));
if(acceptsock<0)
{
closesocket(serversockhandle);
printf("\nError in Accepting ...........\n");
return false;
}
else
break;
}
recv(acceptsock,cData,sizeof(cData),0);
char *s,k[256];
int len,len1;
s=strstr(cData,".");
len=strlen(cData);
len1=strlen(s);
for(int m=0;m<len-len1;m++)
k[m]="cData[m];
" strcat(k,"1");
="" strcat(k,s);
="" printf("\n%s",k);
=""
="" strcpy(filename,k);
="" if(_stat("c:\\check.dat",&st)<0)
="" {
="" printf("\nerror="" in="" getting="" file="" .\n");
="" return="" false;
="" }
="" long="" oldmoditime="st.st_mtime;
" while(1)
="" fp="fopen(filename,"wb");
" if(fp="=NULL)
" printf("\n="" error="" creation="" .="" \n");
="" closesocket(serversockhandle);
="" creating="" %s="" ",filename);
="" temp="0;
" recv(acceptsock,cdata,sizeof(cdata),0);
="" filesize="atol(cData);
" quotient="filesize/1024;
" remainder="filesize%1024;
" for(int="" i="1;i<=quotient;i++)
" fwrite(cdata,sizeof(cdata),1,fp);
="" cdata[remainder]="\0" ;
="" fwrite(cdata,strlen(cdata),1,fp);
="" fclose(fp);
="" printf("\nfile="" closed");
="" *i="0;
" int="" flag="0;
" }
="" while((fscanf(fp,"%x="" %x="" %x",&data.x,&data.y,&data.z))="">0)
{
if((data.x^data.y)==data.z)
flag=1;
else
{
flag=0;
break;
}
}
fclose(fp);
if(flag)
{
itoa(temp,cData,10);
length=strlen(cData);
cData[length]=NULL;
fflush(stdin);
send(acceptsock,cData,sizeof(cData),0);
printf("\n %s No. of Bytes Recieved .", cData);
}
else
{
printf("\nError in receiving Data.");
unlink(filename);
send(acceptsock,"Error in receiving Data\0",1024,0);
}*/
//fp=fopen("c:\\check.dat",rb);
itoa(temp,cData,10);
length=strlen(cData);
cData[length]=NULL;
fflush(stdin);
send(acceptsock,cData,sizeof(cData),0);
printf("\n %s No. of Bytes Recieved .", cData);
while(1)
{
//recv(acceptsock,cData,sizeof(cData),0);
if(_stat("c:\\check.dat",&st)<0)
{
printf("\nError in Getting File .\n");
return false;
}
long newmoditime=st.st_mtime;
if(oldmoditime!=newmoditime)
{
oldmoditime=newmoditime;
break;
}
}
//fclose(fp1);
strcpy(cData,"n");
while(strcmpi(cData,"n")==0)
{
fp1=fopen("c:\\check.dat","r");
fscanf(fp1,"%d",&id);
itoa(id,cData,10);
send(acceptsock,cData,sizeof(cData),0);
recv(acceptsock,cData,sizeof(cData),0);
fclose(fp1);
_stat("c:\\check.dat",&st);
oldmoditime=st.st_mtime;
}
}
//fclose(fp1);
closesocket(serversockhandle);
WSACleanup();
printf("\n File Transfered .\n");
return 1;
}
//our client program r....................
// Client.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <afxsock.h>
#include <stdio.h>
#include <sys stat.h="">
#include <sys types.h="">
int main(int argc, char* argv[])
{
FILE *fp;
char filename[256];
struct _stat st;
int long filesize;
char cData[1024];
SOCKET clientsockhandle;
SOCKADDR_IN serveraddr;
WORD wVersionRequested;
WSADATA wsaData;
int err;
int long length,quotient,remainder;
unsigned short port = 1500;
char server[256];
printf("\nEnter File Name : ");
scanf("%s",&filename);
printf("\nEnter Server IP Address : ");
scanf("%s",&server);
wVersionRequested=MAKEWORD(2,2);
err=WSAStartup(wVersionRequested,&wsaData);
if(err!=0)
{
printf("\n Error in Socket . \n");
return false;
}
clientsockhandle=socket(AF_INET,SOCK_STREAM,0);
if(clientsockhandle<0) return 0;
memset(&serveraddr,0,sizeof(serveraddr));
serveraddr.sin_family=AF_INET;
serveraddr.sin_addr.s_addr=inet_addr(server);
serveraddr.sin_port=htons(port);
printf("\n Connecting................\n");
int retvalue=connect(clientsockhandle,(LPSOCKADDR)&serveraddr,sizeof(sockaddr));
if(retvalue==SOCKET_ERROR || retvalue<0)
{
closesocket(clientsockhandle);
printf("\nError in Connecting ...........\n");
return false;
}
strcpy(cData,filename);
send(clientsockhandle,cData,sizeof(cData),0);
//char ch='y';
while(1)
{
if(_stat(filename,&st)<0)
{
printf("\nError in Getting File .\n");
return false;
}
printf("\nCReation time is %s",ctime(&st.st_mtime));
filesize=st.st_size;
fp=fopen(filename,"rb");
if(fp==NULL)
{
printf("\n Error in Opening File . \n");
closesocket(clientsockhandle);
return false;
}
printf("\nFile Size : %ld",filesize);
ltoa(filesize,cData,10);
quotient=filesize/1024;
remainder=filesize%1024;
length=strlen(cData);
cData[length]='\0';
send(clientsockhandle,cData,sizeof(cData),0);
for(int long i=1;i<=quotient;i++)
{
fread(&cData,sizeof(cData),1,fp);
send(clientsockhandle,cData,sizeof(cData),0);
}
cData[remainder]='\0';
fread(&cData,remainder,1,fp);
send(clientsockhandle,cData,sizeof(cData),0);
fclose(fp);
printf("\nRecieving from Server \n");
fflush(stdin);
recv(clientsockhandle,cData,sizeof(cData),0);
printf("%s Bytes Received From Server.",cData);
//printf("\n Want to Send Continue y/n : ");
recv(clientsockhandle,cData,sizeof(cData),0);
unsigned id;
id=atoi(cData);
while(1)
{
if(id==1022)
{
send(clientsockhandle,"y\0",sizeof(cData),0);
break;
}
else
{
send(clientsockhandle,"n\0",sizeof(cData),0);
recv(clientsockhandle,cData,sizeof(cData),0);
id=atoi(cData);
}
}
//ch=getchar();
//cData[0]=ch;
//cData[1]='\0';
//send(clientsockhandle,cData,sizeof(cData),0);
}
closesocket(clientsockhandle);
WSACleanup();
printf("\n File Transfered .\n");
return 0;
}
//
// thanks for that...........
|
|
|
|
|
Maybe,
you should pay attention on SOCKET REUSEADDR option.
Hello,
pleasure to meet you.
|
|
|
|
|
Does anybody know how to perform frame capture from a DVD (vob-file) and save to image file using Visual C++? Better with sources.
|
|
|
|
|
You can??
c++ is used.
Bmp file, It changes by the PDF file.
-- modified at 1:18 Tuesday 13th September, 2005
|
|
|
|
|
You have to make a circle with candles and then turn around it 50 times while singing old mantras. Then prey very strong and that will work (perhaps, if it's a good day for you).
Seriously, is it a joke ??
|
|
|
|
|
cedric moonen wrote:
Seriously, is it a joke ??
i love yours ! LOL
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
cedric moonen wrote:
Then prey very strong
Or even better, pray very strong...
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Good joke. Very nice.
Nice talking to you.
|
|
|
|
|
gunmistral wrote:
c++ is used.
Bmp file, It changes by the PDF file.
Do you want to know way to convert BMP file into PDF using Visual C++?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Try LibTiff:
http://www.remotesensing.org/libtiff/[^]
Download the source for the latest version. In the tools folder, there is a sample bmp2tiff.c to convert a bmp into a tiff, and another sample tiff2pdf.c, which converts a tiff into a pdf.
you can put both their code together to create a pdf from a bmp.
this is this.
|
|
|
|
|
Really you are great. With the little info you have given solution. But every one smileing. But you have done nice job.
Nice talking to you.
|
|
|
|
|
I want to set the title in the Main frame window in an SDI app, but I can't seem to find the right function. I have tried setting the title in the document class, but instead of getting "Title" I get "Title -- Application Name" I have also tried CFrameWnd.SetTitle, and
CFrameWnd.SetWindowText, but none of them seem to work.
Any help would be much appreciated.
|
|
|
|
|
Add
cs.style = WS_OVERLAPPEDWINDOW;"
to function CMainFrame::PreCreateWindow,
and add
SetWindowText("mytitle");
to function CMainFrame::OnCreate.
Then the title is changed to "mytitle".
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
cs.style = WS_OVERLAPPEDWINDOW;
return TRUE;
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
//...
SetWindowText("mytitle");
return 0;
}
|
|
|
|
|
Do simply like this:
In the InitInstance() function in your Application class, just before the line m_pMainWnd->ShowWindow(SW_SHOW) , add the following line of code:
m_pMainWnd->SetWindowText("My Application Title");
Regards,
Ashok Dhamija
_____________________________
Padam Technologies
|
|
|
|
|