Hi Dw. I'm having a client server which the server read a text file line by line and send each line to the client upon client connection. The problem I'm having is that on the client side the data is combined, meaning I get all lines that are on the file at once but what I want is to get each line just like how it is sent. This is the server side code I have. Dim myFileName As String Dim myLine As String Dim FileNum As Long myFileName = "c:\myfile.txt" FileNum = FreeFile Close FileNum Open myFileName For Input …

Member Avatar
Member Avatar
+0 forum 8

Good Day Everyone: I am creating a tabulating system for a bikini open. How can you create a client-sever application with database on server without using winsock control? One server for monitoring and document printing. I need client for multiple judges (atleat 5) you can add and remove. And a profile for multiple contestants.

Member Avatar
Member Avatar
+0 forum 8

I have now read a total of 5 different winsock tutorials and I still do not get how sockets work! Could somebody please explain how to make a program that will allow n computers to share data with each other. As an example could somebody make a 'game' with the following rules: 1. check for the existence of the server (Give it a unique name?) 2. if it does not exist, create it, you are now the SERVER 3. if it does exist, join it, you are now a CLIENT 4. As a server, repeatedly send out "GAME" to each …

Member Avatar
Member Avatar
+0 forum 10

I am trying to understand how sockets work with winsock, but I just don't get it. I basically want to be able to create these functions: SomeDataType ConnectToComputer(const char *ConnectionName);//connect to the connection named ConnectionName SomeDataType CreateConnection(const char *ConnectionName);//create a connection called ConnectionName bool ReadData(SomeDataType, unsigned char *outdata, int outsize);//read outsize bytes into outdata from the connection and return on success void SendData(SomeDataType, unsigned char *data, int datalen);//send the data to the connection Basically this is what I want to be able to do with those functions: //This is called by the first computer to 'join' the room SomeDataType myConnection=CreateConnection("My …

Member Avatar
Member Avatar
+0 forum 3

Hello all! I really want to make a chat that runs over a network, but Microsoft nor Ostrosoft winsock works. I know I am doing it right, plus for Ostrosoft winsock you need to install its program thing on each computer you use your program on. I did sort of get Ostrosoft winsock to work. I got it to work with a very basic remote desktop program, then I added new features (didn't touch the way it sends and recives) and it just stopped working, and it just won't ever work again. And I could only connect 1 client to …

Member Avatar
Member Avatar
+0 forum 1

Hi ! I'm trying to learn about sockets using winsock in c++. What I want to do is have one computer (my computer) act as a mini server for my friend to connect to directly from his house (different ISP). I am wondering if it is possible using sockets to connect directly without the need to use webpages ? If yes, please direct me to the relevant resources. I have a basic chat program set up which works fine as long as it's within my router (I can connect to a 2nd computer in my local network with a 192.168.x.x …

Member Avatar
+0 forum 0

Hi! this is my first thread here. Please help me. I have no clue how to start monitoring "another computer" in vb.net. I want to make a program just like a "cafe client" that monitors and manipulate another computer. Should i use Winsock? because I had red that winsock is used for chatting application. I'm just really confused right now and I don't know where to start.

Member Avatar
Member Avatar
+0 forum 1

Hi, So I have a very simple server/client program using winsock. In C++. Using MingW as a compiler. This is the code part which does the connecting: [CODE]for(;;) { if(Connect = accept(Listen, (SOCKADDR*)&Server, &size)) { std::cout<<"\nConnection was reached"; } }[/CODE] How can I send and receive simple text from server to clients? Also is a busy loop like the "for" really necessarily in this case? Can't it be done in another way? Thanks.

Member Avatar
Member Avatar
+0 forum 10

Question is: [B]How can I send two strings using SendData in different packets?[/B] Because when I try to send two strings one after another, winsock joins them in a single packet thus making one string received from client/server. For example: [CODE]Winsock1.SendData "String1" Winsock1.SendData "String2"[/CODE] The final received data will be: "String1String2" I guess winsock joins data that are sent in short period of time, is there any way to avoid this? If the packets are analyzed by any sniffer software, there will be one packet containing both strings. Is there any way I can send these two strings separately, in …

Member Avatar
Member Avatar
+0 forum 2

Hi, I am using WinSock library for sending data over network, and I have a problem. I know how to send data in one struct and receive it on the other side, because there is constant size of structure. But what if I have more structures, each one with different size? Now I have one struct that contains locations of players and other with in-game messages. When I am about to receive struct, I don't know which one is being sent. Is there a "trick" how to do that? Thanks for help.

Member Avatar
Member Avatar
+0 forum 7

Hello everyone. I am having an issue with flash style connection So I start off by connecting to port 843 and requesting a <policy-file-request/> The server sends me this: <cross-domain-policy> <site-control permitted-cross-domain-policies="master-… /> <allow-access-from domain="*website.com" secure="false" /> <allow-access-from domain="*website.com" to-ports="443-49151"/> </cross-domain-policy> Since it is non secure, I try to connect to port 443 via connect. However, my connection attempt is declined. What do I do to make it accepted? Here is what I am doing Init Winsock Connect to server port 843 Request policy File Receive Policy file Connect to server port 443... declined. Shouldn't the server accept me as …

Member Avatar
Member Avatar
+0 forum 1

I am developing an application in VB6 which will communicate using UDP Connection to a hardware which recieves and sends data using UDP Connection. My Hardware works fine. It has already been tested with an application written in VisualC using UDP connection only. In VisualC, I had working on UDP Connection without Winsock. Hardware's Remote IP and Port is been set to my computer's IP and Port 4040. My code for connection and sending data is as below : If Winsock1.State = sckClosed Then Winsock1.Protocol = sckUDPProtocol Winsock1.LocalPort = 4040 Winsock1.RemoteHost = "192.168.1.80" 'Hardware IP Winsock1.RemotePort = 4040 'Hardware's Port …

Member Avatar
Member Avatar
+0 forum 1

Hi guys here is my problem.I am trying to send ICMP packets to a HOST using WINSOK.So here is my code: [CODE]#define WIN32_LEAN_AND_MEAN #include <winsock2.h> #include <ws2tcpip.h> #include <stdio.h> #include <stdlib.h> #define IP_RECORD_ROUTE 0x7 // // IP header structure // typedef struct _iphdr { unsigned int h_len:4; // Length of the header unsigned int version:4; // Version of IP unsigned char tos; // Type of service unsigned short total_len; // Total length of the packet unsigned short ident; // Unique identifier unsigned short frag_and_flags; // Flags unsigned char ttl; // Time to live unsigned char proto; // Protocol (TCP, UDP, …

Member Avatar
+0 forum 0

Hello, I was working on my Server - Client comunicating programm for moonth or more, when a tricky issue had met me. I works so: Server does certain commands if client types certain commnads, and I need need the Client to do certain commands if Server types certain commands. I tried to do it the same way as Server receives the commands, but it didn't work. This is working code, but I need to reverse it: ::--Server--:: [CODE]#include <windows.h> #include <stdlib.h> #include <stdio.h> #include <winsock.h> #include <iostream.h> #include <conio.h> #include <signal.h> DWORD WINAPI receive_cmds(LPVOID lpParam) { SOCKET current_client = (SOCKET)lpParam; …

Member Avatar
Member Avatar
+0 forum 4

I am developing a network chat application, I am using Winapi, my main window is a dialog (created from a .rc file). I am looking into a way of doing an text box where my outuput text can be like this: [QUOTE] [COLOR="Green"]Welcome to ##### chat server![/COLOR] [COLOR="Red"]Person1[/COLOR] says: Hi folks, what's up? [COLOR="Red"]Person2[/COLOR] says: Hey... that's Person1! [COLOR="Green"]*Person2 pokes Person1.*[/COLOR] [COLOR="Red"]Person1[/COLOR] says: Hey![/QUOTE] I'm using a simple EDIT TEXT control ATM. I've been trying to implement a RICH EDIT CONTROL but it seems to be very hard to do... Anyone know of a good way to obtain the result …

Member Avatar
Member Avatar
+0 forum 3

Hi During the last 6 months or so I've worked on and off on a couple of a classes to send data over network using winsock and asynchronous sockets on windows. Basically my system works like this. The server will send packets on a connection until WSAGetLastError() returns WSAEWOULDBLOCK the server then proceeds to queue the rest of the packets on the connection. When the connection gets an FD_WRITE message it continues to send data where it left off. The problem I'm having is that sometimes the sending will stop because of WSAEWOULDBLOCK but no FD_WRITE message is sent afterwards. …

Member Avatar
Member Avatar
+0 forum 1

Hi, I am trying to learn winsock programming using online tutorials. This example is from the MSDN library, although modified. I have compiled it and it seems to be working fine for only one request. After handling a single request the server exits. I have read handling multiple request and making the server persistent can be done through threads, but have no idea how do so and no helpful examples found over the internet. Please help. [CODE] #undef UNICODE #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <winsock2.h> #include <ws2tcpip.h> #include <stdlib.h> #include <stdio.h> // Need to link with Ws2_32.lib #pragma comment (lib, …

Member Avatar
Member Avatar
+0 forum 4

Hi everyone! Is there a way/command in C to find a string that is contained in a longer string? I'm currently developing a C program in Windows that sends requests to a machine and gets its response through socket programming. The response is an image in jpeg/jfif format. The whole response looks like the one below: Received data is: [CODE] HTTP/1.1 200 OK SERVER: Network Camera Date: Thu, 01 Jan 1970 00:01:14 GMT Content-Type: image/jpeg Content-disposition: filename="something.jpg" Connection: close [/CODE] I want to receive the image sent to me and it should be viewable. I tried to write the whole …

Member Avatar
Member Avatar
+0 forum 8

Hi, What command/technique is needed in a C program to receive image bytes through socket programming from an HTTP response? I want to develop a program that requests for an image from a server, then upon receiving the bytes comprising the image, it should write these bytes into a newly created file such that an image file is created. The image is of .jpg format. I really don't know how to create a program that receives and stores bytes through sockets so I hope someone here knows how to do it. So far, what I know is how to receive …

Member Avatar
Member Avatar
+0 forum 1

I am a newbie to network programming. I been trying my luck with winsock and am stuck with no idea what to do. Here is a snippet of my code: [CODE]//Bind it to a TCP/IP port SOCKADDR_IN SockAddr; SockAddr.sin_port=24; /*Port to be used*/ SockAddr.sin_family=AF_INET; /*Connection Type: TCP/IP*/ /*Listen on IP address: 127.0.0.1*/ SockAddr.sin_addr.S_un.S_un_b.s_b1 = 127; SockAddr.sin_addr.S_un.S_un_b.s_b2 = 0; SockAddr.sin_addr.S_un.S_un_b.s_b3 = 0; SockAddr.sin_addr.S_un.S_un_b.s_b1 = 1; if(bind(socketDefinition,(SOCKADDR*)(&SockAddr),sizeof(SockAddr))==SOCKET_ERROR) printf("Attempt to bind failed.");[/CODE] The code is compiling properly but output is: "Attempt to bind failed." Any suggestions? Thanks.

Member Avatar
Member Avatar
+0 forum 3

Hi all. I'm trying to develop a Winsock program in C. I can already compile the program correctly but I don't get any output when I run it. I don't know how to exactly use the WSAStringToAddressA function so I think it's the root of my problem. I'm using this function because I already know the IPv4 address of the other machine I'm connecting to and I just need to convert this address to the number format understandable by machines. I don't know now how to debug my program so kindly help me out. Thanks in advance! [CODE] /* #include …

Member Avatar
Member Avatar
+0 forum 1

Hi everybody, this text turned out to be rather long and maybe not so clear, please excuse me. I'm currently using the winsock library to send and receive data in an application made with WinAPI, I'm not using MFC. I'm using asynchronous sockets (I think that's what it's called) which means that I will get a userdefined message posted in my message loop whenever there is data to read, a connection to accept etc. I'm sending my data using TCP. Now I want to write a dynamic recv handler and by that I mean a function that can receive (almost) …

Member Avatar
+0 forum 0

I started learning Winsock (2.2) programming in university recently and when writing my first program (fileserver and its client) a few questions came to mind. Let`s assume my fileserver is continuously listening for client connections and when one occurs it establishes connection, does whatever client wants (such things as list directory contents, file upload or download, etc) then closes connection and again, listens for new incoming connections. Client waits for user input and connects to the server ONLY after receiving it. So, is this kind of thing right? Maybe the connection between client and server should not be terminated after …

Member Avatar
+0 forum 0

Hi im new to the forum & c++. I just want to upload a txt file to a FTP server using winsock. Im writing a c++ application. Application makes a socket connection & communicate with FTP server. I can provide FTP commands & server responses well. I want to know what is the FTP command, which can upload a file to the server. I dont know how to use STOR command. if i provide the command [CODE]STOR myfile.txt[/CODE] it creates a new file in the server. I want to upload a local file to the server how it can be …

Member Avatar
+0 forum 0

Please, How do I properly add a Winsock Control in WPF for purpose of LAN applications? I tried adding the Winsock control dynamically but then the event functions are not available then. Note: Using WindowsFormHost does not show in my WPF application. Help please!

Member Avatar
Member Avatar
+0 forum 1

Hi I am trying to write an application for connecting to JABBER chat server,something like a chat client.i know there are many ways to do this like using agsXMPP library or jabber-net library,i wanna know can someone help me and tell me how can i use Winsock (mswinsck.ocx) to do this? i can connect to a server by winsock but i dont know how can i send username and password with that.the jabber using digest midp method for authenticating . tnx :confused::confused::confused:

Member Avatar
Member Avatar
+0 forum 2

Hi all My code for the server side : [CODE] Dim bmp As New Bitmap(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height, Imaging.PixelFormat.Format24bppRgb) Dim gfx As Graphics = Graphics.FromImage(bmp) gfx.CopyFromScreen(0, 0, 0, 0, My.Computer.Screen.Bounds.Size, CopyPixelOperation.SourceCopy) Winsock1.SendData(bmp)[/CODE] And for the client side in the DataArrival event : [CODE] On Error Resume Next Dim img As Image Winsock1.GetData(img) PictureBox1.Image = img[/CODE] But the picture never come in the picturebox, Also ivé double checked that the connection is ok, Help please :confused:

Member Avatar
Member Avatar
+0 forum 2

Hey everyone, I am developing code to accept TCP communcations from one computer to another. Basically from this forum, all I need is the ability to send a data string to the other computer. here is the code I have to do so. they both are the same application, but can be set to server mode or client mode depending on which computer. you will see the differences in the "radiobutton" events below. basically the server is set to listen. [CODE] public MainForm() { InitializeComponent(); tcpServer.LocalPort = 88; tcpServer.DataArrival += new AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEventHandler(tcpServer_DataArrival); tcpServer.ConnectionRequest += new AxMSWinsockLib.DMSWinsockControlEvents_ConnectionRequestEventHandler(tcpServer_ConnectionRequest); tcpServer.ConnectEvent +=new EventHandler(tcpServer_ConnectEvent); tcpServer.Error …

Member Avatar
+0 forum 0

Hi.. i'm using a winsock control to transfer files between two computers which are in the same network..(LAN) and it works fine. Is there a way to transfer a file to another computer that it is not in my network? For example from my computer to a friend's computer.. Any help would be appreciated.. Thanks

Member Avatar
Member Avatar
+0 forum 7

Hey all, Trying to get a simple LAN based chat program going (required to use UDP and multicasting). I've tried both client/server and p2p implementations, yet I still can't seem to get it working. The best I've gotten with client/server is that clients on pc1 and pc2 will connect to the server and can send data to the server and receive data back. However I couldn't get the server to send the data to all clients. With p2p, I can get each client to send a message, which is then received by itself, not the other clients however. Here is …

Member Avatar
+0 forum 0

The End.