VS 2008 Ftp Client Server Using Sockets.

Sep 22, 2009

i have lots of confused ideas like should you transfer files using tcp? Example: I was thinking, I connect to server from client, open file in binary, division by packet size(bytes), send first packet to server, get request if file was delivered succesfully, send next packet. If I do it this way i would need something to know/increase packet size.

View 5 Replies


ADVERTISEMENT

VS 2008 Client Server - Communicating Over Sockets

Aug 10, 2011

I am building a client-server type applications and they are communicating over sockets. This is the first time I am doing such a program and I have been learning off a web example and thought I understood it all but it would appear I am missing something as it starts to work then errors. Here is what I have:

VB
Dim serverSocket As New TcpListener(ListeningPort)
Dim clientSocket As TcpClient
Dim netStream As NetworkStream
Dim BytesFrom(1024) As Byte
Dim DataFromClient As String
[Code] .....

All of the above works and if I open up a telnet command window I can connect to my machine running this code on my specified port and in the command prompt window 'IDENTIFY' appears as it should from the above code. But it then gets to this block an errors on the second line:

VB
'RECEIVE FROM CLIENT
netStream = clientSocket.GetStream()
netStream.Read(BytesFrom, 0, CInt(clientSocket.ReceiveBufferSize))
DataFromClient = System.Text.Encoding.ASCII.GetString(BytesFrom)

Now as far as I can tell it shouldn't be processing the first line
[ netStream = clientSocket.GetStream() ]
Until I send something back from the client because then going on to the second line its trying to process something that isn't there yet.

The actual error I get is:
Specified argument was out of the range of valid values. Parameter name: size
On the line:
netStream.Read(BytesFrom, 0, CInt(clientSocket.ReceiveBufferSize))

View 8 Replies

Async Sockets Client-server?

Jul 25, 2011

I'm using vb .net 2008 with 3.5 framework. (the following 2 classes are put in a DLL that i import in a main application)

Server class:

Code:
Imports System.Xml
Imports System.Net.Sockets
Imports System.Text
Imports System.Net

[code]....

Basically in my main application i am instantiating the client class from this dll, as well as the server one. On the client form i got a "send data" (SendFISA sub) and a "connect" button. After connecting the client and clicking on the "send data" i am sending to the server a string formed of some information created when instantiating the client class from the dll (i can't make that type of data public, but i'm just using a constructor to assign values to a class object, nothing special).

Now, when the server receives the data sent by "send data" button click it responds with "PKG_SENT" corresponding to the "FISASENT" string terminator(in the module) of the string that was sent. The "WRONG_MSG" constant is for when the string terminator is different from the 2 from above.

On the local disk, if the server cannot be reached, the client saves an xml file with this data. In the dll i made a timer that ticks every 5 seconds and checks to see if there is any xml file on the disk and sends it to the server if the connection is ok (trimiteXML sub). The server would respond with "XML_SENT" corresponding to the string terminator "XMLSENT"(in the module) appended to the read string from the xml file. After the file is sent it is deleted from the local dir.

The problem occurs when i click "send data" AND there are XML files to be sent from the disk. I believe they are interpreted by the server somehow at the same time because the message is neither "PKG_SENT" nor "XML_SENT", but it becomes a combination of the "WRONG_MSG_TYPE" and "XML_SENT", "XML_SENTG_TYPE". I have no idea why this is happening and i basically want the socket to wait with sending the files from the disks until the "send data" finishes.

View 9 Replies

Client/Server Using Sockets(Question)

Jul 31, 2011

i have this code from msdn and added some of mine..

Public Shared Sub DoAcceptTcpClientCallback(ByVal ar As IAsyncResult)
' Get the listener that handles the client request.
Dim listener As TcpListener = CType(ar.AsyncState, TcpListener)

' End the operation and display the received data on
' the console.
Dim client As TcpClient = listener.EndAcceptTcpClient(ar)

' Process the connection here. (Add the client to a
' server table, read data, etc.)

Dim networkStream As NetworkStream = client.GetStream()
Dim bytes(client.ReceiveBufferSize) As Byte
networkStream.Read(bytes, 0, CInt(client.ReceiveBufferSize))
Dim clientData As String = Encoding.ASCII.GetString(bytes)
MsgBox(clientData)
' Signal the calling thread to continue.
tcpClientConnected.Set()
End Sub 'DoAcceptTcpClientCallback
now the question is how can i put the clientdata from a listview?
i tried to put the listview control in this shared sub but i always got an error..
Quotecannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit initializer of the class
please enlighten me on this one..

View 1 Replies

TCP Server/Client - Disconnecting Sockets?

Aug 18, 2011

TCP Server/Client - Disconnecting Sockets

View 3 Replies

Program That Uses Sockets To Connect Server To Client

Aug 2, 2010

i made a program that uses sockets to connect the server to client but there is a problem with it when i try it on this ip"127.0.0.1"wich is not a real ip just a loopback to my computer it works just fine when i use my local ip it works as well when i use my main ip from http:whatsmyip.org it doesnt work at all i dont know why it doesnt say an error or an exception but its not connecting so i gave the server to a friend of mine i tried using both his real ip and his local but still not working i dont know why?i mean i am 100% sure of my code...

View 7 Replies

VS 2008 TCP Server / Client - Client To Send The Server 4 Numbers - Depending On The User's Choice

May 9, 2009

how to create a client/server... But I couldn't... I don't want anything fancy. Just want the client to send the server 4 numbers, depending on the user's choice; after that, the server would turn off the pc, restart it, etc. It all depends on the number received. Is there a rather "simple" way to do it? If it's not to much trouble you could use Atheist's example. (Btw I don't understand the code and, yes, I've checked on [URL])

View 9 Replies

VS 2010 When The Client Closes Sockets The Server Closes As Well

Apr 9, 2012

I have a small problem with sockets (I'm new to sockets). Below is the code I'm using. The problem is that when the client closes, the server closes aswell. How do I stop it from doing that?

[Code]...

View 1 Replies

VS 2008 Chat Server/client - After The Client Clicks Disconnect Or Closes By Task Manager, Looses Connection

Aug 18, 2009

Im using the code from [URL] as a starter, most of the code is the same. the chat system works fine but on the client a added a disconnect button "clientSocket.Close()" and as soon as i click that i get errors, on the client, this is the code...

Private Sub getMessage()
For infiniteCounter = 1 To 2

[CODE]...

And this line...

serverStream.Read(inStream, 0, buffSize)
gives me "Unable to read data from the transport connection: A blocking operation was interrupted by a call to WSACancelBlockingCall."

Now im talking the server, after the client clicks disconnect or closes by task manager, looses connection, etc the server crashes and gives me.

View 5 Replies

Sockets + Windows Server 2008 = Memory Leak?

Jan 29, 2010

We have a small service shows continuous nonpaged pool bytes increase from the moment it is started. This is only on a 2008 server (all the others work fine).

The service basically connects a socket to a client to see if it's successful and then closes (most code omitted):

[Code]...

View 3 Replies

VS 2008 Async Socket Connections - Clear Out No Longer Useful Sockets From The Server?

Dec 18, 2009

I have been developing an async socket connection server and client program. I have been testing it, and noticed that if I connect to the server from my client and then disconnect. Upon reconnecting I am on a different port(local IP still). This is fine, however when I go to send a message, and the server trys to update all the clients, it eventually hits clients that do not exist anymore. I get the SocketException 10054, and upon connecting/disconnecting enough, it no longer works at all. My question is how do I clear out these no longer useful sockets from the server? I am doing currentsocket.Shutdown(SocketShutDown.Both); and then a currentsocket.Close(); after that. When a user disconnects.

[Code]...

View 1 Replies

VS 2010 : Send Data From Client To Server (encrypted) And The String Sent From The Client Is Not The Same As Received From The Server?

Jun 27, 2011

Hey guys, I am trying to send data from client to server (encrypted) and the string sent from the client is not the same as recieved from the server. I've been killing my brain for hours to get this to work but I cant manage. Im converting everything to Base64 string.

Client:

Public Sub SendMessage(ByVal msg As String)
Try
SyncLock myclient.GetStream
sw = New IO.StreamWriter(myclient.GetStream)

[code]....

View 4 Replies

C# - Client Side Sockets Library

Nov 30, 2009

Be able to instantiate the object and hook up the MessageReceived and ConnectionChanged events (or ones with similar purposes). Be able to send data (duh) When data is received, it fires the MessageReceived event on the same thread that the object was created on (this would be nice, but not absolutely required). Have a blocking and non-blocking options for connecting and possibly sending data.

View 2 Replies

VS 2008 Multi-User Chat Program (Server & Client) With Main Server?

Aug 10, 2009

Multi-User Chat Program (Server & Client) with Main Server?

View 1 Replies

SQL Server 2008 Configuration For Client Server (Windows Form) Application

Apr 6, 2012

Case : I'm creating an application (desktop application) with VB.NET (actually windows form), and using SQL Server Express 2008 for its database.

[Code]...

View 1 Replies

System.Net.Sockets Namespace - Use For A Chat Client?

May 31, 2009

How would I use this for a chat client? I'm not sure where to even start and the internet is helping me find much about it.

View 4 Replies

Client-Server-Client Multithreading - Instant Message Another Client

Jun 21, 2010

We are creating a Who wants to be a millionaire style game in VB. Our server is pulling information such as questions and answers from a Access Database and sending them to the contestants (Clients). All transfer of information is directly from the server to each client. One of the "Life Lines" we want to use is "Ask a friend", where one client is able to Instant message another client for a short time to get help on the question.

[Code]...

View 2 Replies

Create Client-server App, In Which Client Can View Files On Server?

Nov 15, 2011

basically i just want client to say "C: emp" ENTER

then, server must reply with all its files in c: emp

View 1 Replies

VS 2008 : TCP Server/Client "send Hashtable To Client App"?

Jul 15, 2009

i have been working on a chat program Server side and client side i have most of the features i was asked to put in but then once i got most of the bugs out i noticed something the server admin could send whispers and alerts to single users but then when you try do do it on the client side it wont work so i looked through it all and found my issue the user list on the client is only a list of the names in server hash table so i was wondering how do i send the hashtable and all of its data E.G. user connection information to the client so that it can send commands to individual users like the server side can

vb
Public clients As New Hashtable()
' This subroutine checks to see if username already exists in the clients
' Hashtable. If it does, send a REFUSE message, otherwise confirm with a JOIN.

[code]....

i tried to send the hashtable over the same method used to send the user names to the client but it cannot convert the hashtable to a string so that wont work so my question is How do i send the hash table to the user from the server then display the username on the client ??

View 39 Replies

Communications :: Client-server Communication Program - Click On CmdListen In The Server Form And CmdConnect In The Client Form

Jul 23, 2008

The problem I have is: When I click on cmdListen in the server form and cmdConnect in the client form,both programs won't respond and they crash for some reason I don't know.

Client source code:

Code:

Imports System.Net.Sockets
Imports System.Text
Public Class Form1

[CODE]...

Code:
Imports System.Net.Sockets
Imports System.Text
Public Class Form1

[CODE]...

View 3 Replies

Communications :: Socket Behaviour - Created A Client That Can Send And Receive Data Via TCP Sockets

Aug 26, 2010

I have created a Client that can send and receive data via TCP sockets. The objects stored on the serverside are the *exact* same object used for the client. They use the same send and receive protocols.

Now, when i send a string from the server to the client , it does precisely what it should do. However when I send a string to the server.... I do receive the string as an equal length of NULL characters. I run the server and client locally.

Basicly what can influence the behaviour between two completely identical objects performing the exact same task? I wonder if there is some socketflag issue if the TCPlistener.accept function returns a completely different setup then the one I R used to.

(if it is of any interest, the send protocol is asynchronious)

View 3 Replies

Server/Client - Basic Tcp Server/client Application

Mar 30, 2009

I've basically made a basic tcp server/client application. The thing is that I'm behind a router and so will be the other people that use my clients. I've had to use port-forwarding or the software "rinetd"to run quite a few applications online.

Let me explain: I'm on a lan network that connects to the internet. Whenever I want to host a server - for instance a basic ftp or http server. If I give my external IP to anyone, they won't be able to access my server. Even if I portforward, it doesnt work. I have to use rinetd here. For other applications, portforwarding works. I'm not sure how these things work at all.

Anyway, my issue now is that I have created this server/client application. I'm having serious doubts that if I run the server, I'll have to either a) portforward or use rinetd to get people to connect to my server. IF I need to portforward, that's fine. However, using rinetd would really suck... My 2nd concern is as follows: IF the person running the client is in a similar situation as me (i.e he's on a lan that has a router which connects to the net), will he have to portforward or use rinetd as well? If he portforwards that's fine. But I don't think I could get people to use rinetd.... Also, if there are more than 1 person on a lan trying to connect to my server, there is a big problem when they try to portforward: they will only be able to allocate one of their internal ip to that port, and the others won't be able to connect, right? How does this work? I mean, I use many softwares like msn/skype/(some games)/firefox that do not need portforwarding/rinetd. Yet they work. My housemates(other people on the lan) use the same softwares, and it works fine. There's no clash/probs watsoever How come these run fine?

Anyway, back to my issues. Given I have no knowledge about how the above work, I was wondering whether there was a way to host a vb .net server application on an external website (external to my house) so that I might *avoid* the above mentioned problems, and to what extent that would be a sound solution.

View 11 Replies

Creating FTP Server And Client In 2008?

Aug 26, 2009

procedure to create a FTP Server and Client program in VB 2008 with sample code?

View 2 Replies

VS 2008 Create A Tcp Client And Server?

Jun 30, 2009

i wan't to create a tcp client and server

Client contains 1 textbox
Server contains

dim pcdetails as string
pcdetails = "Operating System Name : " + My.Computer.Info.OSFullName.ToString + " ; " + "Platform : " + My.Computer.Info.OSPlatform + vbNewLine + "Operating System : " + Environment.OSVersion.ToString + " v." + Environment.OSVersion.Version.ToString + vbNewLine + "Computer Name : " + Environment.MachineName.ToString + vbNewLine + "User Name : " + Environment.UserName.ToString + vbNewLine + "System

[code]....

View 7 Replies

VS 2008 Making Client And Server?

Apr 11, 2009

I'm making a program that would require me to send data between to different machines.The way i plan to do this is to have a server program constantly running on my computer.(any other way to do this?) When someone opens the Client program, the program connects to the server. The server then takes the users I.P address and Username and adds it to a listbox on the Server application. Then the server application constantly updates the list of users on the Client application. So that way every user can see everyone that is connected.Then, when the user wants to connect to another user - They select the Username from their listbox of users. Then all connections will be handled between the users = Each user is connected to the other user's Client program. Well there is the first thing i don't know how to do.The next is simply how i send the data between the users. Would i use a winsock control?Example: One user does an action. The winsock control sends the text "blue" to the other user. The other user's program's form color changes to the color blue. That's not what this program will do, but it's just an example.

View 6 Replies

VS 2008 TCP Client/Server Threading?

Nov 11, 2009

Is is possible for the server to give all clients that are connected to it a separate threading starting from 1-2-3-etc that will be display there username on a listview. Server can now connect to any of them by clicking on one of the items in the listview.

EX: Multi-Clients Connect to server ---> Server gives each one a separate thread starting with 1 ----> Client sends username to server -----> Server displays them on listview ---> Server can now double click or whatever on the item ---> Pulles up thread count and connects to it.

View 1 Replies

VS 2008 Vb Connecting Server And Client?

Aug 23, 2010

i write a vb code that it can do connect to serverthe question is when i connect to the server the server have receive the connected and the client exists not found serverit shows out this warning "strData' is passed by reference before it has been assigned a value. A null reference exception could result at runtime."

View 4 Replies

Writing A Program With 1 Client And Server Where Client Side Creates A Text File

Dec 1, 2008

I have been reading through Atheists posts in regards to client-server and TCP client/server connection's. But how do i go about writing a program with 1 client and server where the client side creates a text file.Once the server sees there is a text file it connects and downloads it to itself or the client pushes the text file to the server.Once on the server i will read the text file and put its info into a sql db.

View 14 Replies

VS 2008 : Creating Own DataReader Like TCP Client/Server?

Jun 2, 2010

I'm not even sure where to start. I would like to create something like the ADO DataReader but that works in a TCP Client/Server scenario.Basically, in the TCP Client, I want to be able to call a certain command in the TCP Server which will return a DataReader like object, which I can then iterate through such as:

while dr.Read from the client. In each loop, I would parse out the various fields as in a normal DataReader.The reason I want to do this is to gain the inherent efficiency of the DataReader object since it doesn't first load ALL of the data. To my understanding, the typical TCP Client/Server setup using streams, would first load all of the data on the server, then transport ALL of that data to the client for processing. I want to avoid that, and just stream the data as the client requests through the Read() command which means the connection will remain open to the server while the Read() command is being issued by the client, or until explicitly closed by the client.

View 5 Replies

VS 2008 Client Server To Access A Database?

Dec 10, 2011

I would like to create a server program that accesses an "ms access" database. I will also need a client program that connects to the server. The reason for this is that the server is a mediator for several clients. Since I am using access, I plan on maybe having 20 or 30 clients connect to the server only. The client will have access to a virtual market. So when a person buys or sells something on the market, the server mediates the transaction and etc. At the same time, the access database saves each clients data as well as the overall market data.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved