Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Winsock/cookie Request Entity Too Large...


hi i'm sending a cookie header via winsock but i think it's to large cause I'm receiving a "Request Entity Too Large" in the HTTP Response. is there a way around this?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Still Trying To Send Cookie With HTTP Request
I can communicate with the server and the app works as long as a cookie exists on the workstation I am running on. The problem is that I need to be able to run on a workstation that does not have a cookie. I cut and pasted this out of Microsoft's VBHTTP example program. The cookie is just not going out correctly, if at all. Can anyone see what I am doing wrong? Thanks!

The URL is: is009999/dummy.com/ExprexxXXX?AccountId=12345678&TXN=SearchByAccountId&Format=XML"

Code: hInternetSession = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_PRECONFIG, _
        vbNullString, vbNullString, 0)
    If Not CBool(hInternetSession) Then
        MsgBox "Cannot Connect to Network", vbCritical + vbOKOnly, "Get Customer Information"
        ReadNet = ""
        Exit Function
    End If
    dwPort = 7001
    hInternetConnect = InternetConnect(hInternetSession, CheckUrl, dwPort, _
                            vbNullString, vbNullString, INTERNET_SERVICE_HTTP, 0, 0)

    hHttpOpenRequest = HttpOpenRequest(hInternetConnect, "GET", GetUrlObject, "HTTP/1.1", vbNullString, 0, _
                    INTERNET_FLAG_RELOAD Or INTERNET_FLAG_KEEP_CONNECTION, 0)

    SCookie = "Set-Cookie: ewebprefs=B,C,A,E@@NA@@999999@@NA@@V13"
    iRetVal = HttpAddRequestHeaders(hHttpOpenRequest, SCookie, Len(SCookie), _
            HTTP_ADDREQ_FLAG_REPLACE Or HTTP_ADDREQ_FLAG_ADD)

    sHeader = "Accept-Language: en" & vbCrLf
    iRetVal = HttpAddRequestHeaders(hHttpOpenRequest, sHeader, Len(sHeader), _
            HTTP_ADDREQ_FLAG_REPLACE Or HTTP_ADDREQ_FLAG_ADD)
                        
    sHeader = "Connection: Keep-Alive" & vbCrLf
    iRetVal = HttpAddRequestHeaders(hHttpOpenRequest, sHeader, Len(sHeader), _
            HTTP_ADDREQ_FLAG_REPLACE Or HTTP_ADDREQ_FLAG_ADD)
 
    sHeader = "Content-Type: text/html" & vbCrLf ' "Accept = image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd." & vbCrLf
    iRetVal = HttpAddRequestHeaders(hHttpOpenRequest, sHeader, Len(sHeader), _
            HTTP_ADDREQ_FLAG_REPLACE Or HTTP_ADDREQ_FLAG_ADD)
   
 iRetVal = HttpSendRequest(hHttpOpenRequest, vbNullString, 0, sData, Len(sData))
   
    DoEvents
    
    Sleep 1000 'sleep for one second
    sData = ""
    
    Do
        sBuffer = vbNullString
        bRet = InternetReadFile(hHttpOpenRequest, sBuffer, Len(sBuffer), lNumberOfBytesRead)
        If Not bRet Then Exit Do
        If Not CBool(lNumberOfBytesRead) Then Exit Do
        If (Len(sData) + lNumberOfBytesRead) <= 65534 Then
            sBuffer = sBuffer & Left$(sBuffer, lNumberOfBytesRead)
            sData = sData & sBuffer
        End If
    Loop
      
    ' Close Intranet connections
    If hInternetURL <> 0 Then InternetCloseHandle (hInternetURL)
    If hInternetSession <> 0 Then InternetCloseHandle (hInternetSession)

    ReadNet = sData

End Function

Winsock, Form And Cookie. *** Help Please ***
Hi to everybody.
I am new, and I apologize me for my English, but I don't speak English.
  
I have tried to make a search in the forum, but I have not found what served me.
  
I have a problem.
  
I would like to know if, opening a page web, the parameters of a form could automatically be drawn for submit, as it is possible to do through WebControl:
  
Code:WebBrowser1.Document.Forms(0).submit
  
I would like to know even if it is possible to read the cookies received by this page and to send them in the HEAD, when it makes him the post with Winsock. If this is not possible, can a cookie be eliminated inserted by the page during the navigation with WebBrowser?
  
Thanks, I hope to receive answers as soon as possible

Winsock Syntax? (To Request A Website With The Winsock Control)
Ok, I don't know very much about Winsock and am just now starting to use it. I'm making an anonymity program that modifies referer and user agent data. I managed to find an example of how its done on planetsourcecode.com but there's a few things that aren't working.

Anyway, when this string is sent, it sends the headers and a request for index.html from the connected host (winsock1.connect domain.com 80).

GET index.html HTTP/1.0
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-comet, */*
Accept-Language: en
Accept-Encoding: gzip , deflate
Cache-Control: no-cache
Proxy-Connection: Keep-Alive
User-Agent: Whatever
Referer: www.whatever.com

But when I used the website http://ipid.shat.net/ as the domain to see if code mdified the headers or not, it directed me instead to just www.shat.net. How would a browser request information to ipid.shat.net?

Also, I noticed that by sending just that information, cookies don't work properly. What other tags do I have to add onto that for it to recieve my session information? Thanks a lot.

Display Entity Relations
Hy,
does anybody know how to find an activeX Control
with that i can display Entity Relations like Database Models. I mean draw an rectange that representates a table and lines between the tables that representate the Relations.(An Example is the Option "Relations" in MSAcess)

Okay thank you very much

Winsock Request
I have a Winsock component setup right now on my network, exact same as whats in this thread

I would like to know if a similar control can be built using Winsock to do this:


1) Connect to a remote computer, by IP address. (I have a code that determines the IP address of the remote machine already..)

2) Open a .txt file, send it back to (my) the users computer and displays it in a text box on screen.

3) On command button press, take what ever is in my text box, and send the file back to the remote computer and save it.

Kind of like editing a configuration file, remotly.

I know the application would have to be running on the remote end as well as my end for this to work, if its at all possible.

I would really like to do this, I appeciate everyones help in advance!

Winsock Example Request
I'm at work where I can't get to any help files for winsock.  Can somebody give me a quick example of the code required to create a winsock instance, including telling it to listen and respont to internet requests?  I'm going to attempt to make MS Access act like a simple server, and I just don't have the resources here to get it running.  Thanks!

Winsock HTTP Request Help
I need help with this, my wrapper uses winsock to send requests and the close event does not fire which makes the connection stay open forever, my wrapper is at the bottom it is a attachment

WinSock Request Accept
Hey,

I have been trying to get this code to work, It's most likely something stupid am doing, but i cant get my server program type thingie to accept the Request ID from the client program thingie... Here is the code to the part that it says is wrong (If you need anyother parts tell me an i'll post it)


Code:
Private Sub HostSocket_ConnectionRequest(ByVal requestID As Long)

'Show Request In Host Log
HMsg = "Connection request id " & requestID & " from " & HostSocket.RemoteHostIP
HostLog.AddItem (HMsg)

sRequestID = requestID
iSockets = iSockets + 1
ConNumber.Caption = iSockets
Load HostSocket(iSockets)
HostSocket.LocalPort = 1007
HostSocket.Accept requestID

End Sub
PS. I looked at an example to help me with this, so am not sure whats wrong.

Thx in advance.

Ali.

Can Winsock DLL Do Other Protocol Request ...
guys,

i find that the winsock OCX really is limited in its capability...
can anyone suggest me a better one for network programming? because the protocol type is limited to a few only....

I hope to do RTSP / RTP request ... is there any thing that i can used to do that ???

can Winsock Dll do other protocol request or its the total same with the winsock OCX?

Does anyone has a sample using winsock DLL (as client)...??

Winsock : GET Http Gives Me Bad Request , Why?
guys,

is the statement below wrong??

GET http://www.hypermart.com HTTP/1.0


the dataarrival shows me error message...

400 BAD Request

can anyone justify this please?

Multiple Request With Winsock
Greeting,

I have a little problem with winsock. I have a server and several
client. I want to transfer text from server to client trough the network
In this case, I using winsock to transfer the text. It is ok when only 2
computer connected (1 server and 1 client). But, when 3 computer
Connected (1 server and 2 client) I cant broadcast text to all client.

Does any body know how to broadcast text fom server to client trough the
network and winsock?

thanks

Rgds,
Rano Nugrah Agung Homan

Winsock Sample Request
Hi all,

I need to make a server app for my project. I have concluded that I will need to implement Winsock to do so. I have read up on all Winsock articles here (and many others elsewhere) and have downloaded and studied all the samples I could find.

However, I am unable to do what I want because:

- The tutorials say that the IP address or friendly name of the target computer MUST be specified for the Winsock control to connect on the other side. This strikes me as very backward, as I can not always know what IP addresses my customers' network stations will be running on and cannot also predict their friendly names. Does this have to be hard-coded?

- Try as I may, I cannot create a working sample of Server.Exe and Client.Exe to run on the same machine as I cannot afford the luxury of testing my code over two machines. Is there any way I can debug / test on one machine?

If any member proficient with Winsock (Laura Stephens and Jason Rogers come to mind) would like to help, I shall appreciate a small sample to get me started by solving the above two problems.

GoodGuy
Experience is a bad teacher for its exams precede its lessons.

Edited by - GoodGuy on 12/10/2007 10:23:30 PM

Winsock Array Connection Request
i made a post a couple days back gavino answered
im trying to make my multi chat program and well, it isnt goin by too well. for starters the client cant connect

Code:
Private Sub sckSocket_ConnectionRequest(Index As Integer, ByVal requestID As Long)
SockNum = SockNum + 1
Load sckSocket(SockNum)
sckSocket(SockNum).Listen
sckSocket(SockNum).Accept requestID
End Sub
is there sumthing wrong with that?

[VB6] Winsock POST Request Problem
I'm trying to connecto to google.com and translate a simple word (just to test if works).

And I have a problem when I'm sending POST request data, here is my code:


Code:
Private Sub Command1_Click()
Winsock1.Close
Winsock1.Connect "www.google.com", "80"
End Sub


Private Sub Winsock1_Connect()
Dim packet As String
Dim strpost As String

strpost = "hl=it&ie=UTF8&text=hello&sl=en&sl=en&tl=it&tl=it"

packet = "POST /translate_t HTTP/1.1" & vbCrLf
packet = packet & "Host: www.google.com" & vbCrLf
packet = packet & "Accept: */*" & vbCrLf
packet = packet & "Accept-Language: it,it-it;q=0.8,en;q=0.5,en-us;q=0.3" & vbCrLf & vbCrLf

packet = packet & "Content-Type: " & "application/x-www-form-urlencoded" & vbCrLf
packet = packet & "Content-Length: " & Len(strpost) & vbCrLf
packet = packet & strpost

Winsock1.SendData packet

Text1.Text = Text1.Text & packet

End Sub


Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim data As String

Winsock1.GetData data
Text2.Text = Text2.Text & data & vbCrLf

End Sub



As you can see I want the GETDATA in Text2.Text but I recieve this error:


Code:
HTTP/1.1 411 Length Required
Date: Fri, 01 Aug 2008 13:57:24 GMT
Content-Type: text/html; charset=UTF-8
Server: GFE/1.3
Content-Length: 1357

{html code}


What's the problem?!

Thanks in advance.

How Can You Request A Webpage Using Winsock And HTTPS?
HTTP is easy to form requests with using winsock..
but how can you make requests to a https site?

WinSock Connection Request Error!
When I use this code for a winsock connection request:

Code:
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Accept requestID
txtRecive.Text = txtRecive.Text & vbCrLf & "ChatX: Connection Request Detected."
End Sub


I get runtime error 40020:
Invalid operation at current state

when I hit debug it highlights that code snippet up there! HELP

Viewing Cookies Sent With Either Winsock Or INet Request?
Hello,

Is there a way that I can send a request via INET (Most Likely), and read the cookies which were sent with that request?

Thanks

Winsock Server Connection Request Problem
hey, this is my code


Code:
Private Sub wskServer_ConnectionRequest(ByVal requestID As Long)
Dim msgboxResult

msgboxResult = MsgBox("A connect request has been initiated by: " & wskServer.RemoteHostIP & vbNewLine & "Would you like to accept it?", vbYesNo, "Connection Request")

If msgboxResult = vbYes Then
wskServer.Accept requestID
isServer = True
End If
End Sub


now the problem is, whenever i run it, and have a client try to connect to it, this is the error the server gives me on this line "wskServer.Accept requestID"

---------------------------
Project1
---------------------------
Run-time error '40020':

Invalid operation at current state
---------------------------
OK
---------------------------

can someone help?


EDIT: and yes, i did try:
wskServer.Close
wskServer.Accept requestID

but it doesn't work. if u need 2 see my whole code to know whats going on, just let me know

Winsock - Notification When User Accepts Request
Does anyone know of a way that an initiator of a Winsock connection can be notified when a user on the other end accepts the connection ? I'm new to Winsock, so my terminology might not be the best, but I'm trying to find out if the inititator has any way of knowing that a connection was made before any messages are exchanged?

Thanks for any help....

Does Anyone Have An Example Of How To Send A POST Request With Winsock And A Proxy?
I know how GET works with winsock and a proxy, but how can you use a proxy and use POST?

anyone have an example?

HELP: Winsock To Send HTTP POST REQUEST To A Machine
Hello,

I would like to use visual basic to send data to a machine using an HTTP Post request, and cannot decide on the best way to do it. Can I use winsock. Please bear in mind the following.

I am sending a mult-part message (kind of like an email with attachments). It's actually a multimedia message in the MM7 format -> this is similar to email, a multipart MIME message.

I MUST post to a destination using the following format:

http://192.168.3.75:2097/mm7

I need to then send the data which I've formated according to the MM7 spec.

I need to receive responses from the receving application.

Any help would be greatly appreciated.

Thanks

Ben

Different Way Of Sending Large Pic With Winsock,
In 222-1335999 we thrashed out a topic on how to send large files thru winsock.

I worked out an apparently faster simple way of sending a picture in an ImageBox in one computer to another ImageBox in another computer over a network and would appreciate anybody's comments.

This is a combination of a number of other people's methods.

Because Winsock breaks the pic into 8k chunks, these chunks have to be either assembled by winsock or later in code after arrival.

Using the former method requires 4 winsocks.
The latter uses 2 winsocks but many more 'firings' of the Sub_Dataarrival.

But if you cut down the number of statements encounted encounted during the accumulation, and Dims at the head of DataArrival, and have only a simple numerical comparison, it dramatically improves speed for the second method.

For a high resolution 1mb picture, the best I could get between 2 computers was 400ms letting winsock do the accumulating but under 200ms doing it in the dataarrival (on a 1gb network).

Oddly it took 10 seconds between a 1gb and a 100mhz machine but not between 2 100mhz machines.

So this is what I did

CODE'----------- transmitter -------------------
Dim TxHeader as Boolean
Dim Pb as New Propertybag
Dim Emptybag as New Propertybag

Sub Transmit()
Dim HeaderPb as New Propertybag
Pb.Contents=EmptyBag.Contents 'Clear old pic
Pb.WriteProperty "Picture", Image1(Index).Picture, 0
HeaderPb.WriteProperty "PicSize", ubound(Pb.Contents)+1, 0 'remember picture
Winsock1.SendData HeaderPb.Contents 'send size first
Set HeaderPb = Nothing
Txheader = True
End Sub

Private Sub Winsock1_SendComplete()
'does not send pic until header has been received and first 8k got from the pic.
If Txheader = True Then
    Winsock1.SendData Pb.Contents
    Txheader = False
End If
End Sub

'---------receiver----------- I have 20 other indexed winsocks running in this app all receiving different pics at random.

Dim RxHeader(20) as Boolean, Picsize(20) as Long

Private Sub Winsock_DataArrival(Index As Integer, ByVal bytesTotal As Long)
'Each received camera picture chunk goes into a stream. When the stream is complete it is put into a propertybag in a separate sub.
Dim Buffer() As Byte
Winsock(Index).GetData Buffer, vbByte Or vbArray
If RxHeader(Index) = False Then
   'intially must be a header
    If StreamRx(Index).State <> 0 Then StreamRx(Index).Close
    StreamRx(Index).Open 'create a stream for picture
    StreamRx(Index).Type = adTypeBinary
    StreamRx(Index).Write Buffer
    ProcessArrivedData Index
Else
    'must be a part of picture here so accumulate picture in the stream until stream is full
    StreamRx(Index).Write Buffer
    If PicSize < StreamRx(Index).Size Then Exit sub
    ProcessArrivedData Index 'Stream is full of picture.
End If
Exit Sub

Sub ProcessArrivedData(Index As Integer)
'this is where you remember the size and process the collected data
On Error Goto ProcessError
Set RxPb(Index) = New PropertyBag
StreamRx(Index).Position = 0
RxPb(Index).Contents = StreamRx(Index).Read(adReadAll) 'Put all of stream into new propertybag
StreamRx(Index).Close
If RxHeader(Index) = False Then
    'Data must only be the size of picture so remember it
     PicSize = RxPb(Index).ReadProperty("PicSize", 0)
     Header(Index) = True
     If StreamRx(Index).State <> 0 Then StreamRx(Index).Close
     StreamRx(Index).Open 'reopen stream ready for picture
     StreamRx(Index).Type = adTypeBinary  
Else
    'Data must be the complete picture so show it
    Set Image1(Index).Picture = RxPb(Index).ReadProperty("Picture", 0)
    Header(Index) = False
End If
Set RxPb(Index) = Nothing
ProcessEnd:
On Error Goto 0
Exit Sub

ProcessError:
'happens if pic never gets received and starts again
Header(Index) = False
Resume ProcessEnd
End Sub

Private Sub Winsock_ConnectionRequest(Index As Integer, ByVal requestID As Long)
Winsock(Index).Close 'if previously open
Winsock(Index).Accept requestID
TxHeader(Index)=False 'in case it is left high and dry by disconnection
End Sub


Sending Large Files Through Winsock
i wrote a program that sends files through a winsock. The program loads the entire file into a string then sends the string. This works fine with small files (30 - 50 mb) but with larger files i get a "Out of string space" error. If i just created an array of strings and split the file up would that solve my problem? Or am i getting that error becouse all of my physical memory is taken up? If that is the case would i have to load the string to its max, send it, then dump that string and fill up another one and send that?

note: This will have to send large (1 to 5 Gb ) files.

Thanks,
Brian

Large File Transfers With Winsock
What's the best way to do large file transfers, 1mg or bigger, 10 mg or bigger, folders with a dozen files. I have client and server connected via winsock.

How To Send Large Files Through Winsock?
I created a program that sends file maximum 2 gb size through winsock.
I first sent through winsock the filesize of the file that i want to send.
I use filelen(path) for getting data... but the returned value is long so I can only find out the filesize of files maximum 2 gb... Why should I do?

Sending Large Files Through Winsock
ok. i know lots of people have problems with this, but they all seem to be using huge ammounts of code. im using this very simple code:

NOTE: the variable "uploadthis" has a path and filename to the
file to upload, and the variable "uploadto" has a path and filename to put the recieved file.


'CLIENT SEND FILE:
'------------------------------------------------------
Dim char As Byte
Dim nextchar As Long
nextchar = 1

Open uploadthis For Binary As #1
Do While nextchar <= LOF(1)
Get #1, nextchar, char
Winsock1.SendData (char)
'MsgBox (char)
nextchar = nextchar + 1
Loop
Close #1
'------------------------------------------------------


'SERVER RECIEVE FILE:
'------------------------------------------------------
Open uploadto For Binary As #4
Put #4, , infoo
Close #4
'------------------------------------------------------


See its very basic, but it doesnt send big files, just small images and things. i couldnt even send a 20kb exe file. any help appreciated.

thanks.

Large File Transfers With Winsock
What's the best way to do large file transfers: 1mg, 10mg, folder with a dozen files? I have client and server connected via winsock

Downloading Large Files Through Winsock Causes Corruption
Hi All,

I have an application that I have written that downloads updates from a remote server, these updates are movies, powerpoint files etc using Winsock over TCP. Everything works fine until the file I download is > 16.5mb and after that the file becomes corrupted in certain areas (maybe the odd missing byte here of there) which obviously renders them useless in powerpoint as they cannot be recognised.

Any ideas before I have to re-write the whole program using another method (which is my worst nightmare!)

Cheers

Large Perdicament (Winsock Sending Files)
Ok here's the problem.. Im sending several files (unknown amount) from the server to a client. But during the send, it will stop with an error that says "Connection is aborted due to timeout or other failure".

After receiving that error i added in some Delay's thinking maybe its a timeout, but even with just a single 1 second delay, i get this message: "Connection is forcefully rejected".

So its either going to quick or too slow.. I cant get it perfect so i need to do something different.

Im using the code from this thread http://www.vbforums.com/showthread.php?t=377648

I couldnt figure out how to get the thing to send multiple files back to back, so the way ive got it setup, it will load each file path and name into a text file line by line, and get it line by line and hit the send button. Once its done and the file and winsock are closed, it hits that button again to send the next..

I already successfully did this in the control panel of my program to update everything, but going the other way it just wont work properly..

When the program starts up, it loads the splash screen and connects to the server with Winsock1. It then sends the version of the current exe file to the server and checks it with the stored EXE in the update folder on the server computer. If there's a new version it sends back information to the client letting it know it needs an update and the server closes and launches the patcher (not necessary but i'll explain later if needed). The client computer does the same, downloads the new exe and replaces it, then runs it again.

If there isnt a new version of the program, then it sends back the file count to the client so the client can calculate the percent completed, then sends "Start" back to the server and from there it will start sending the files.

The client computer has a 2nd winsock control on it thats already Listening for a connection, and when the server receives "Start" it goes through and runs the code to start sending each file 1 by 1, the server also has 2 winsock controls for this. Im testing it locally on this computer for now until its ready, then i'll put the server app on the server. So for now, everything is set at 127.0.0.1, Here's a bunch of hopefully helpful code:

Client Side Code
I'll only show the code for the 2nd winsock control that is supposed to receive the file, since the first one works properly, and this is the section with the errors.


Code:
Private Sub SckReceiveFile_DataArrival(Index As Integer, ByVal bytesTotal As Long)

Dim sData As String, Pos As Long, Pos2 As Long

SckReceiveFile(Index).GetData sData, vbString

If sData <> "®±Finished˘¤" Then
If Clients(Index).FileSize = 0 And InStr(1, sData, ":") > 0 Then
Pos = InStr(1, sData, ",")

Clients(Index).FileSize = Val(left(sData, Pos - 1))
Pos2 = InStr(Pos, sData, ":")
Clients(Index).FileName = Mid(sData, Pos + 1, (Pos2 - Pos) - 1)

Clients(Index).FileNum = FreeFile
Select Case Clients(Index).FileName
Case Is = "q.dw"
lblStatus.Caption = "Updating Basic Questions"
Open App.Path & "" & Clients(Index).FileName For Binary Access Write Lock Write As Clients(Index).FileNum
Case Is = "JobSpec.dw"
lblStatus.Caption = "Updating Job Specific Questions"
Open App.Path & "" & Clients(Index).FileName For Binary Access Write Lock Write As Clients(Index).FileNum
ProgressBar.Value = ProgressBar.Value + (100 / FileCount)
Case Is = "Prod.dw"
lblStatus.Caption = "Updating Product Data"
Open App.Path & "" & Clients(Index).FileName For Binary Access Write Lock Write As Clients(Index).FileNum
ProgressBar.Value = ProgressBar.Value + (100 / FileCount)
Case Is = "ProdPrice.dw"
lblStatus.Caption = "Updating Pricing Information"
Open App.Path & "" & Clients(Index).FileName For Binary Access Write Lock Write As Clients(Index).FileNum
ProgressBar.Value = ProgressBar.Value + (100 / FileCount)
Case Is = "systemdw.dat"
lblStatus.Caption = "Updating Global Settings"
Open Environ("windir") & "" & Clients(Index).FileName For Binary Access Write Lock Write As Clients(Index).FileNum
ProgressBar.Value = ProgressBar.Value + (100 / FileCount)
Case Else
ImgCount = ImgCount + 1
lblStatus.Caption = "Updating Product Images (" & ImgCount & " of " & FileCount - 4 & ")"
Open App.Path & "Images" & Clients(Index).FileName For Binary Access Write Lock Write As Clients(Index).FileNum
ProgressBar.Value = ProgressBar.Value + (100 / FileCount)
End Select

sData = Mid(sData, Pos2 + 1)

Me.lstConnections.ListItems(Index + 1).SubItems(3) = Clients(Index).FileName
Else
frmMain.Show
Unload Me
End If

If Len(sData) > 0 Then
Clients(Index).BytesReceived = Clients(Index).BytesReceived + Len(sData)
Put Clients(Index).FileNum, , sData

PicShowPercentage picProgress, Loc(Clients(Index).FileNum) / CDbl(LOF(Clients(Index).FileNum))

If Clients(Index).BytesReceived >= Clients(Index).FileSize Then
SckReceiveFile_Close Index
End If
End If
End If
End Sub


Under 'Close', where it has the code for the end of the file i have it set to listen again just as it finishes, so that its ready for the next file.

Server Side Code

Once winsock is done connecting, it hits the connect button for me which is this code:

Code:
Private Sub cmdSendFiles_Click()
Dim Buffer() As Byte, P As Long
Dim CurFile As String
Delay 1
Input #10, CurFile
txtFileName.Text = CurFile
Select Case CurFile
Case Is = App.Path & "q.dw"
Label1.Caption = "Sending Basic Questions"
SendFile txtFileName.Text
Case Is = App.Path & "JobSpec.dw"
Label1.Caption = "Sending Job Specific Questions"
SendFile txtFileName.Text
Case Is = App.Path & "Prod.dw"
Label1.Caption = "Sending Products"
SendFile txtFileName.Text
Case Is = App.Path & "ProdPrice.dw"
Label1.Caption = "Sending Prices"
SendFile txtFileName.Text
Case Is = Environ("windir") & "systemdw.dat"
Label1.Caption = "Sending Global Settings"
SendFile txtFileName.Text
Case Else
Label1.Caption = "Sending Product Images"
SendFile txtFileName.Text
End Select
End Sub


The SendFile sub will connect to the client computer, and when it connects, it runs this code:

Code:
Private Sub SckSendFile_Connect()
Dim Buffer() As Byte, P As Long
lblSendFile.Caption = "Connected"
SendIdle = False
If Finished = False Then
Delay (1)
iFileNum = FreeFile
Open sFileName For Binary Access Read Lock Write As iFileNum

ReDim Buffer(lngMIN(LOF(iFileNum), PacketSize) - 1)
Get iFileNum, , Buffer ' read data

SckSendFile.SendData CStr(LOF(iFileNum)) & "," ' send the file size
P = InStrRev(sFileName, "")
SckSendFile.SendData Mid(sFileName, P + 1) & ":" ' send the file name
SckSendFile.SendData Buffer ' send first packet
Else
SckSendFile.SendData "®±Finished˘¤"
SckSendFile.Close
Finished = False
Delay 1
SendIdle = True
CheckRestart
SckSendFile.Listen
Label1.Caption = "Listening on port " & Winsock1.LocalPort
sFileName = ""
iFileNum = 0
End If
End Sub


Im not sure what the timer does since i dont understand the code for sending the files. But here's some code that uses it, i think its whats sending the file somehow:

Code:
Private Sub SckSendFile_SendComplete()
' can't call SendData here, so enable timer to do it...
tmrSendFile.Enabled = False
tmrSendFile.Interval = 1
tmrSendFile.Enabled = True
End Sub



Code:
Private Sub SckSendFile_Close()
lblSendFile.Caption = "Disconnected"
tmrSendFile.Enabled = False
tmrSendFile.Interval = 0

Close iFileNum ' close file
iFileNum = 0 ' set file number to 0, timer will exit if another timer event

SckSendFile.Close

cmdSendFile.Caption = "&Send File"
PicShowPercentage Me.picProgress, 0
lblProgress.Caption = "0.00% Done"

If Not EOF(10) Then
cmdSendFiles_Click
Else
Close #10
Label1.Caption = "Finished Updating Server!"
SendIdle = True
cmdListen_Click
Finished = True
End If
End Sub


Ok, not sure what else to show you guys, so if you need anything else lemme know.

Ive been trying to fix this issue for 3 days now, ive put 10~12 hours of work on this each day and still im nowhere... Ive recoded it several different ways using just the 1 winsock for doing everything, ive split it into 2 which its currently at now, and all kinds of other stuff.. I cant get it to work!!

PLEASE HELP!!!!!!!

POP3 Over Winsock. Not Receiving Large Emails ?
I have a nearly-functioning piece of POP3 code.
The problem is though that it won't receive any large emails.

So if I log in manually into our server, and do a LIST, I get this :


Code:
+OK 27 23806920
1 1614
2 18962
3 13484
4 15545
5 5706
6 3415
7 4034
8 15316
9 15590
10 13282
11 15799
12 23511382
13 3367
14 4028
15 15736
16 13922
17 18730
18 27240
19 4004
20 3379
21 13723
22 15533
23 18342
24 13742
25 3394
26 4046
27 13605
.


As you can see email number 12 is quite large.
For some reason though, when my client sends through "RETR 12", absolutely nothing happens.
All the emails before that are retreived perfectly, but when I ask for 12, just nothing happens.

Any thoughts ?

Sending Large Files Via Winsock Control
I've made a little chat program which can send files between computers as well as chatting. However, to do this i'm reading the file (binary) into a string and then sending that info. Then at the other end i recieve that info in a string and writing it back to a file.
Now my problem is, if the file is too large (tried one that was about 45megs ) then it crashes. Out of string space. Which is fair enough i guess...

My question to you is, how do i resolve this?

One idea i have, which i haven't sorted yet is to watch for the too large error and then change the string (maybe have an array) and read into that. Then send each string in a loop.
Problem i can see with that is synchronisation between computers, although that can be resolved with a fair bit of work.

Anyone have any other ideas?

Sending Large Amount Of Data Useing Winsock, And It Slows My Application?
THis is my code:


Code:
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Public Function SendLIST(index As Integer)
Dim FreeF As Integer
Dim LocData() As Byte
Dim LenData As Long
Dim sendloop As Long

FreeF = FreeFile

Open "D:PROGRAMList.txt" For Binary As #FreeF

ReDim LocData(1 To 2048) As Byte ' Work in 2kb chunks

LenData = LOF(FreeF) ' Get length of file

For sendloop = 1 To LenData 2048 ' Go through file

Get #FreeF, , LocData 'Get data from the file nCnt is from where to start the get

Form1.Winsock1(index).SendData LocData 'Send the chunk

Next

If LenData Mod 2048 <> 0 Then ' If there is any left over at the end

ReDim LocData(1 To LenData Mod 2048) As Byte ' Clear up the leftovers

Get #FreeF, , LocData 'Get data from the file nCnt is from where to start the get

Form1.Winsock1(index).SendData LocData 'Send the chunk

End If

Close #FreeF ' Close the file

Sleep 200 ' Let computer catch up
End Function



Is their any where in their where I can add a command that
will make sure my program does not go ape **** on me, so it
does other stuff everynow and then?

Change The Desktop Font Size (normal, Large, Extra Large)
Hallo,
I’m writing a little application that has to change the screen appearance font size (normal large and extra large) at run-time.
I have already read several posts about how to get the DPI setting back or change it. The problem is how to propagate this change to the system.

Sending a WM_SETTINGCHANGE message with SETNONCLIENTMETRICS
WPARAM affects only the Desktop Icons. The taskbar and start menu are not affected.


Code:

SendMessageTimeout HWND_BROADCAST, _
WM_SETTINGCHANGE, _
SPI_SETNONCLIENTMETRICS, _
0&, _
SMTO_ABORTIFHUNG, _
10000&,
dw_Result




Thanks a lot for helping


James

Sorting Large Number Of Large Text Files
Hi,
I have around 500 text files (csv format). Each file is ca. 5MB and sorted by a timestamp. my application needs to playback all these files line by line but sorted by time.my goal is not to put all files in memory, use a sorting algorithm, create one sorted output file and then read from the output file.
I am rather thinking of sorting the files as they stream. For this I would only need to know in each file the time stamps of the current lines and compare them to each other.
what is the best way to do this? any ideas?
thanks

Winsock Connection Prob: "Request To Connection Time Out".
Hi All,

I am developing chat application like Yahoo and MSN messenger. Also i have almost completed it. I have two applications one is server appliation which will be run on chat server machine. the other is client appliation which will be used at any corner of the world.

Its working fine on my network. Ya, it is also working fine over network but with some misbehaviour. Sometimesm, it allow someone to login and sometimes it doesn't and gives "Request to connection time out" error.. I can't find the reason y it is happening.

I have developed this in visual basic and used winsock control.

Getting A Cookie
Ok I need to get a cookie from Yahoo in order to login using VIsual Basic. I have this now...

Code:
Private Sub Command1_Click()
Winsock1.Connect "login.yahoo.com"
End Sub

Private Sub Command2_Click()
Winsock1.Close
End Sub

Private Sub Winsock1_Connect()
Winsock1.SendData = "GET /config/login?.src=&login=" & Collegefreak11 & "&passwd=" & PASS & "&n=1 HTTP/1.0" & vbCrLf & "Accept: */*" & vbCrLf & "Accept: text/html" & vbCrLf & vbCrLf

End Sub
I want the cookie to go to a textbox. I dont know how.

How Set Cookie In Vb Exe?
Hi all. Just wondering how to set a cookie in a non-web enabled executable using VB 6.0. Any ideas???

A little background:
I am writing a setup program which needs to take some user input and save it on the machine in the form of a cookie during configuration. After setup (during the show), the machines will talk to a client's server via the web and must have this cookie set so the client's server will know which machine is sending the information and accept the transfer of data.

Jenn

Let Go My Cookie!!
Is there a way to intercept a web site to insert cookie
on your pc!!

I'm working with the web browser and the thing is that
more than one people will use the program. You
know when you go on a site and they keep information
on you store in a cookie, -->I don't want that!!
I want every visite to a site be the same,i don't want it
so that the second time it say,Hi Seb ,long time no see!

I think you know what i mean

Thanks a lot !!!!!!

Eat The Cookie!
I know how to delete files in VB. Nut what I need to know is how to delete only files with a certain word at the begining.
For example, delete all the files in "C:/my folder/", but delete only the ones with the word "Cookie:" at the beggining.

Also, How do I tell if a folder is empty or not?

please help,
(I know I've made quite a few posts lately, because I've been programming alot)

Cookie
hi

i want to know how to make cookie by VB6.0 copy it self to "cookies" folder

& "Temporary Internet Files" foder so plz help me by simple code


thanks

Cookie Path
Im writing my own browser with buttons only which directs the user to a specific page. That page generates a cookie and i want that cookie to be saved in the application path. Anybody knows how to do that?

Is Cookie Set On Users Pc?
is it possible to find out if a particular cookie is set on users pc?

Cookie Monster
I have a question about setting cookies (Just like when you sign in and get a cookie) through Visual Basic... How is it done?

Javascript && VB Cookie Use
Goodday all! [virgin poster!]

I'm creating a complex web content management system. I want to create a preview feature before user uploads their data into the database.

1. Users enter data via a webform.
2. Utilising Javascripts 'on the fly' features I grab a feilds value and put it in a cookie when user clicks preview button. Basically saving the form data toa cookie.
3. A popup window opens (.asp file) with the preview of user formatted data. This is done by retrieving and displaying the cookies information using VBscript.

the problem is this:
Javascript formats cookie data as such
varName1=varData1; varName2=varData2;
Vbscript formats it like this:
varName1=varData1&varName2=varData2

anyone got any experience i dealing with this porblem / got an idea how I might be able to work this one????


Answers on a postcard please! :P
salmo X

Cookie Editing
Hello,

Say if you have a WebBrowser control on your form which navigates to a site which contains a cookie.

How in visual basic would you edit that cookie, and then refrsh the page so your edited cookie takes effect ?

thank you

Accessing A Cookie By Name And By Key In VB
hi all:
in my VB(not VBScript) , i am trying to get a value from a cookie by using its name and its code...
here is a snippet of my code


Code:
Dim objRequest As ASPTypeLibrary.Request
objRequest.Cookies.Item(name)

now i know the above is fine for getting

WebBrowser Cookie
Hi,
Where does the cookie of the webbrowser (ieframe.dll) are stored?

Thanks!

Clear Out Cookie
Hello, is there a way that VB can clear out cookie for a specific site and form?

thanks

Get Cookie Data
with this as an example:


Code:
strWebPage = "http://anysite.com"
objHTTP.Open "GET", strWebPage, False
objHTTP.send



u can get the headers by:

objHTTP.getAllResponseHeaders()

and the text by:

objHTTP.responseText

but how about the cookies?

the cookies that return to the cookies folder and what the header responses are show different results.

Copyright © 2005-08 www.BigResource.com, All rights reserved