I want to do socket programming in C. Where client and server are exchanging messages. I have the sample codes with me, but i wanted some elaborate links and tutorials for socket programming C, so that i can write effective and error free code. I will be working with WinSock library and not on Linux. Any help?
...
Hey! I am trying to connect to my localhost and the index page I have there. But every time I try I just get:
Dados -> HTTP/1.1 400 Bad Request Date: Thu, 16 Apr 2009 15:25:41 GMT Server: Apache/2.2.10 (Win32) PHP/5.2.8 Content-Length: 226 Connection: close Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//D...
Hello,
I'm tired of the .NET BeginRead,EndRead stuff.I'd love to use WSAAsyncSelect the way I used to in Delphi/C++
//Async CallBack handler Declaration
procedure MessageHandler(var Msg:Tmessage);Message WM_WINSOCK_ASYNC_MSG;
//Where i setup the Async
dwError := WSAAsyncSelect(Sock, form1.handle, WM_WINSOCK_ASYNC_MSG, FD_CLOSE or FD_R...
Hello,
How can I get a specific message on a specific method?
I've seen some examples and people use "ref" ,but I dont understand it.
In delphi,for example,my function(method) must be declared in the Main Form class and next to the declaration I have to put the message
type
TForm1 = class(TForm)
...
protected
procedure Me...
Hello,
I want to convert message.WParam to Socket.
protected override void WndProc(ref Message m)
{
if (m.Msg == Values.MESSAGE_ASYNC)
{
switch (m.LParam.ToInt32())
{
case Values.FD_READ:
WS2.Receive(m.WParam);
case Values.FD_WRITE: bre...
I am porting a communications library from Linux to Windows. I know what my approach is for the most part. The library uses all raw ethernet level frames for all the communications.
The library I am porting from makes use of the PF_PACKET family and the struct sockaddr_ll. After browsing through the MSDN winsock site, I haven't fou...
I am doing a project where I must craft custom packets. That is, I have to have control of each packet header. I am trying to do this using sockets. Basically, what I need to do is this:
SOCKET s = socket(PF_UNSPEC, SOCK_RAW, ethernet_type);
The ethernet_type is something that is customized, non-standard, like 0xAAAA. I am using h...
Hello,
I tried to send a packet on the socket I use to listen for connections - i failed of course.
I remember the days I coded in pascal that there was another socket I should send connections too,it was received after "Accept".
Well,if this is correct then this is my problem:
I'm using WSAAsyncSelect() in my TCP server(C#)
protect...
My goal is to have this program send a logout command when the user is logging off or shutting down their pc.
The program is connected to a server application via a tcp socket using a Winsock object. Calling singleSock.SendData "quit" & vbCrLf is simply a way of logging out. I am going to start capturing data with Wireshark, but I'd l...
I noticed that when I call closesocket, the completion routine of WSARecvFrom (which by that time waits for incoming data) is being triggered with dwError=0 and cbTransferred=garbage, eve though there is no incoming data pending for that socket.
Any way for it not to be called when i close the socket? I tried to call shutdown prior to ...
What I am trying to do is use the Detours library to hook into an applications WinSock2 send() and recv() functions (a packet logger).
While it does work for the send() function, it does not, however, work for the recv() function.
Here is my relevant code:
#include <cstdio>
#include <ctime>
#include <fstream>
#include <iomanip>
#inclu...
I need to count amount of bytes sent and received from the network by various applications. First I thought about using LSP, but there is a lot of applications that do not use LSP at all (SMB for example). This is why I have written a small sniffer. This application works on IP level and collects data using recvfrom.
So I have address...
I've got this code in my socket class:
bool GSocket::Listen(int Port)
{
d->Socket = socket(AF_INET, SOCK_STREAM, 0);
if (d->Socket >= 0)
{
sockaddr Addr;
sockaddr_in *a = (sockaddr_in*) &Addr;
ZeroObj(Addr);
a->sin_family = AF_INET;
a->sin_port = htons(Port);
a->sin_addr.OsAddr = INADDR_ANY;
if (bind(d->Socket, &Addr, ...
I have a windows services that bind to some TCP port, this port is use for IPC between my application.
Is there a programming (WinAPI/WinSocket and etc) way to know which application connected to my port?
i.e. in my Windows Services I would like to get a PID of the process that connected to my port.
...
I'm about to develop some sockets related stuff in C++ and would like the software to be as portable between Windows and Linux as possible right from the start (making it portable later is tricky.)
I've looked at different libraries, there is one for C++ from alhem.net and of course there is boost::asio. boost::asio looks very promising...
how can you send image file to remotesystem using winsock.
...
I'm designing a networking framework which uses WSAEventSelect for asynchronous operations. I spawn one thread for every 64th socket due to the max 64 events per thread limitation, and everything works as expected except for one thing:
Threads keep getting spawned uncontrollably by Winsock during connect and disconnect, threads that won...
string SendRequestToServer(std::string url)
{
struct sockaddr_in addr = { 0 };
struct hostent *host = NULL;
// If the URL begins with http://, remove it.
if(url.find("http://") == 0)
url.erase(0, 7);
// Get the host name.
string hst = url.substr(0, url.find('/', 0));
url.erase(0, url.find("/", 0));
// Connect to the host.
host = geth...
Ok - this is in continuation from my earlier question about sending an email using a php script. I'm now using PEAR to send the mail. The php script i use is the following one (successfull if executed alone): PHPEMail.php
<?php
require_once "Mail.php"; // Pear Mail.php
$from = "FromName <[email protected]>";
$to = $_POST["dest...
hai sir how to communicate remote system using win sock control through internet. this is possiple give example or any idea in vb.net 2005
...